Problems whit insert from psql - Mailing list pgsql-interfaces

From Enrique Rodriguez Lazaro
Subject Problems whit insert from psql
Date
Msg-id 38427553.E8A9482@xpress.es
Whole thread Raw
List pgsql-interfaces
Hi.

How can I do a 'insert' from psql?

I can do a select but I can't do a insert.

The select:

sprintf(temp_string,"DECLARE atotal CURSOR FOR select * from clientes");
res1 = PQexec(conn,temp_string);if (PQresultStatus(res1) != PGRES_COMMAND_OK) { fprintf(stderr,"DECLARE CURSOR command
failed0");PQclear(res1); exit_nicely(conn);}
 


All it's ok.

The insert:

sprintf(temp_string,"DECLARE atotal CURSOR FOR insert into clientes
values('3','prueba','123')");
res1 = PQexec(conn,temp_string);
if (PQresultStatus(res1) != PGRES_COMMAND_OK) { fprintf(stderr,"DECLARE CURSOR command failed0"); PQclear(res1);
exit_nicely(conn);}

The problem aren't in data base. At psql's prompt i can do:

psql==>insert into clientes values('3','prueba','123');

Ok, no problems.

Thanks in advanced.


pgsql-interfaces by date:

Previous
From: Roberto Joao Lopes Garcia
Date:
Subject: Re: [INTERFACES] libpq + multiple connections ...
Next
From: "Oscar Serrano"
Date:
Subject: RE: [INTERFACES] Spanish format on date and numbers