Received: from maria.xpress.es (bestia.xpress.es [194.224.86.3]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA72275; Thu, 23 Dec 1999 11:15:14 -0500 (EST) (envelope-from enrique@xpress.es) Received: from xpress.es (idefix.xpress.es [194.224.86.59]) by maria.xpress.es (8.8.8/8.8.8) with ESMTP id RAA11330; Thu, 23 Dec 1999 17:09:29 GMT Sender: enrique@bestia.xpress.es Message-ID: <38624AD0.D6AD053@xpress.es> Date: Thu, 23 Dec 1999 17:16:16 +0100 From: Enrique Rodriguez Lazaro X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.0.36 i586) X-Accept-Language: en MIME-Version: 1.0 To: PSQL ADMIN Subject: Re: [INTERFACES] Ghost insert References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "D'Arcy J.M. Cain" wrote: > > Thus spake Enrique Rodriguez Lazaro > > Hi. > > > > I am trying to do a interface from a web over my database postgresql > > whit libpq. > > > > I can't do a simple 'insert' from libpq. > > Just guessing here but is it possible that clientes is a view and you are > seeing the underlying table when you select after the insert? In PostgreSQL, > views are real tables. They just have an implied rule on select that gets > data from a SELECT statement instead of the named table. See the following > URL for more details. > > http://www.postgresql.org/docs/programmer/rules890.htm > > > I'm doing this: > > > > sprintf(temp_string,"insert into clientes > > values('fff','prueba','123','123','pepe gotera','jjjjjj','jjj')"); > > > > res1=PQexec(conn,temp_string); > > tuplas=PQresultStatus(res1); > > If the above is not your problem then you might also try PQoidStatus(res1) > to see what the resulting OID is. > I can't resolve the problem. clientes is a table, isn't a view. All it's correct with respect the distints solutions that i have recived. The last time i have put this on my C program: sprintf(temp_string,"insert into clientes values('f','p','1','23','pepe gotera','j,'j')"); /* NOTE: the ';' it's not necesary*/ res1=PQexec(conn,temp_string); tuplas=PQresultStatus(res1); imprime_cab_html(0); printf("Status: %s

\n",PQoidStatus(res1)); printf("Resultado: %s

\n",PQresStatus(tuplas)); printf("Temp_string: %s\n",temp_string); printf(""); And the result it's this: Status: 19648 Resultado: PGRES_COMMAND_OK Temp_string: insert into clientes values('f','p','1','23','pepe gotera','j','j') That's the clientes table: \d clientes Table = clientes +----------------------+----------------------------------+-------+ | Field | Type | Length| +----------------------+----------------------------------+-------+ | id_cli | text not null | var | | empresa | text | var | | nif | text | var | | ubicacion | text | var | | telefono | text | var | | contacto | text | var | | observaciones | text | var | +--------------- ------+----------------------------------+-------+ Index: clientes_pkey The permissions over this database are: > \z Database = xpress +---------------+--------------------------+ | Relation | Grant/Revoke Permissions | +---------------+--------------------------+ | clientes | {"=","nobody=arwR"} | | comerciales | {"=","nobody=arwR"} | | prueba | {"=","nobody=arwR"} | | prueba_id_seq | | | seq1 | | | tecnicos | {"=","nobody=arwR"} | 'nobody' is the apache user. If nobody run the query insert from the prompt of psql, the insert have effect. It's ok. Where it's the problem? Thanks in advanced.