"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<br><p>\n",PQoidStatus(res1));
          printf("Resultado: %s<br><p>\n",PQresStatus(tuplas));
          printf("Temp_string: %s\n",temp_string);

          printf("</body></html>");


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.

************

Reply via email to