Thread: PQexec problem

PQexec problem

From
François LODIER
Date:
Hi, when I try to do something like
PQexec(conn,"BEGIN");
I have got stranges logs like query:
ø(
ERROR:  parser: parse error at or near "ø"

It seems that postgres doesn't recieve the good query does any one no why ??
 
 

-- 
--------------------------------
François Lodier             .   _
.                         __     .
.                        ..     ...
zentak@agisphere.com      .  __  .
Ouais! Et pourquoi ??      ... .
---------------------------------
 

Re: PQexec problem

From
François LODIER
Date:
Hi all,
sory to disturb you once more but in fact my  problem is not whith PGexec but with PGsetdb.
When I try to connect to my data base, a query is done and has a strange form. There follows my logs :

FindExec: found "/usr/lib/postgresql/bin/postgres" using argv[0]
debug info:
       User         = postgres
       RemoteHost   = 192.168.1.168
       RemotePort   = 3881
       DatabaseName = qmail
       Verbose      = 2
       Noversion    = f
       timings      = f
       dates        = European
       bufsize      = 128
       sortmem      = 512
       query echo   = t
InitPostgres
query: x33(
ERROR:  parser: parse error at or near "x3"
AbortCurrentTransaction

So if anybody could explain me why this stuff is doing this, it would be great !

-- 
--------------------------------
François Lodier             .   _
.                         __     .
.                        ..     ...
zentak@agisphere.com      .  __  .
Ouais! Et pourquoi ??      ... .
---------------------------------
 

Re: Re: PQexec problem

From
Tom Lane
Date:
=?iso-8859-1?Q?Fran=E7ois?= LODIER <zentak@agisphere.com> writes:
> When I try to connect to my data base, a query is done and has a strange
> form. There follows my logs :

> FindExec: found "/usr/lib/postgresql/bin/postgres" using argv[0]
> debug info:
>        User         = postgres
>        RemoteHost   = 192.168.1.168
>        RemotePort   = 3881
>        DatabaseName = qmail
>        Verbose      = 2
>        Noversion    = f
>        timings      = f
>        dates        = European
>        bufsize      = 128
>        sortmem      = 512
>        query echo   = t
> InitPostgres
> query: x33(
> ERROR:  parser: parse error at or near "x3"
> AbortCurrentTransaction

> So if anybody could explain me why this stuff is doing this, it would be
> great !

If you look into src/interfaces/libpq/fe-connect.c, you'll see that as
soon as the frontend libpq has established a connection, it sends a few
SET commands to set things like timezone and datestyle based on
client-side environment variables.  I think something must be hosed in
that logic, but I'm not sure what.  Try adding a few printf's in there
or stepping through it with a debugger to see what's going wrong.

Also, if you are using psql, it sends a command or two as soon as libpq
comes back; it's possible that the broken query is coming from there.
Again though, it's hard to see what could be going wrong.  (You could
try starting psql with -E switch to see what it thinks it's sending.)

Keep us posted what you find out ...

            regards, tom lane