Question: Hi I have to send data to server via JSON and usually I do it like that:

```
  NSMutableString * temp=[[NSMutableString alloc] initWithString:service_registra_inc];
   //here I add more staff to temp
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:temp]];
    [[NSURLConnection alloc] initWithRequest:request delegate:self];

```

but I get some error message that the url is wrong: something like url length but I have searched around and it means I have to escape my url si I have found this fonction that doesn't work for me:

```
 NSString *temp2=(__bridge_transfer NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,((CFStringRef)temp.UTF8String),NULL,NULL,kCFStringEncodingUTF8);

```

and there the program just stops and it says `signal EXC_BAD_ACCess`.

Well I don't really know how to transform mutable strings into CFStringRef so xcode just suggested the corrections for me but I don't really understand what is happening. Please help.... I have read the doc but it doesn't say how to cast NSSMutableString to CFStringRef and back or how to use the whole thing to create an NSURL object directly. Thks

Answer: 
By writing `insert into test_table values (v_row.*);` you actually force postgres to insert NULL value into the `id` column.

You will need to run such code - either in application 

```
v_row.id := nextval( 'mysequence' );

```

.. or in trigger 

```
IF NEW.id IS NULL THEN
    NEW.id := nextval( 'mysequence' );
END IF;

```
You can check, if Postgresql have a SEQUENCE for this column and then, if this column have a DEFAULT value set. In `psql` try:

```
\d+ test_table

```

You have to see somethink like this:

```
id    | integer                     | default nextval('test_table_id_seq'::regclass) |

```

If there is not a `default nextval('somethink')`, then you have to check, if there is sequnence for this column:

```
\ds+

```

You have to see somethink like this:

```
 public | test_table_id_seq | sequence

```

If you will not have a sequence, you have a CREATE it:

```
CREATE SEQUENCE test_table_id_seq;

```

And if you will have not a `default nextval('somethink'), you have use a ALTER TABLE:

```
ALTER TABLE test_table ALTER COLUMN id SET DEFAULT nextval('test_table_id_seq');

```

You can find about it some informations here: <http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-SERIAL>

Perhaps you can understand it, although English is not my native language...