Problems whit insert from psql

From: Enrique Rodriguez Lazaro <enrique(at)xpress(dot)es>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Problems whit insert from psql
Date: 1999-11-29 12:45:07
Message-ID: 38427553.E8A9482@xpress.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Browse pgsql-interfaces by date

  From Date Subject
Next Message Oscar Serrano 1999-11-29 13:12:15 RE: [INTERFACES] Spanish format on date and numbers
Previous Message Roberto Joao Lopes Garcia 1999-11-29 12:19:59 Re: [INTERFACES] libpq + multiple connections ...