psqlODBC generating incorrect SQL?

psqlODBC generating incorrect SQL?

am 17.02.2006 03:35:16 von Michael Shulman

Hi,

Can anyone think of a reason that the windows psqlODBC driver would
generate SQL that doesn't quote strings correctly? I am seeing lines
in psqlodbc_xxxx.log that begin like:

conn=3D160249744, query=3D'UPDATE "public"."application" SET
"decision"=3DAccepted WHERE...

There is no column in my table called Accepted; that is a text string
that I tried to set the field "decision" equal to. But somehow it
didn't get quoted when it was put into the SQL, producing many error
messages like 'column "accepted" does not exist'.

I'm using MS Access, so possibly the problem is there; I don't know
enough about ODBC to say. However, psqlodbc_xxxx.log tells me that
the sql statement was constructed from one looking like

UPDATE "public"."application" SET "decision"=3D? WHERE ...

by filling in parameters, so it seems to me that it is the driver that
is at fault, since it must have filled in the parameters.

I'm very confused about how this could be happening. It doesn't
happen on my computer, only on one of my users' computers, running the
latest version of psqlODBC in Windows XP. Any suggestions would be
greatly appreciated!

Thanks,
Mike

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Re: psqlODBC generating incorrect SQL?

am 17.02.2006 12:53:55 von Ludek Finstrle

> Can anyone think of a reason that the windows psqlODBC driver would
> generate SQL that doesn't quote strings correctly? I am seeing lines
> in psqlodbc_xxxx.log that begin like:

It seems to me that psqlODBC means it is another type.

> UPDATE "public"."application" SET "decision"=? WHERE ...

It uses binding parameters. Nothing new. I don't know what leads to
the problem.

> by filling in parameters, so it seems to me that it is the driver that
> is at fault, since it must have filled in the parameters.

Maybe driver or something another doesn't work correctly.
What's the decision column type?

> I'm very confused about how this could be happening. It doesn't
> happen on my computer, only on one of my users' computers, running the
> latest version of psqlODBC in Windows XP. Any suggestions would be
> greatly appreciated!

It could be interesting to see mylog outputs (from your computer - the
correct one and from user's comupter - the faulty one).
Maybe you don't have same connection options.
Are you both using same psqlODBC driver (version ant type - ANSI vs.
Unicode)?
And what about backends, ...?

Regards,

Luf

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Re: psqlODBC generating incorrect SQL?

am 17.02.2006 16:41:07 von Michael Shulman

On 2/17/06, Ludek Finstrle wrote:
> Are you both using same psqlODBC driver (version ant type - ANSI vs.
> Unicode)?

That was it! She had it set to ANSI and mine (and the database) is
Unicode. Changing hers to unicode fixes it. Thanks!

It would be nice if the driver could give a more informative error
message if this happens, though. I never would have guessed that
would cause a problem like this.

Best,
Mike

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Re: psqlODBC generating incorrect SQL?

am 17.02.2006 17:08:02 von Ludek Finstrle

Fri, Feb 17, 2006 at 09:41:07AM -0600, Michael Shulman napsal(a):
> On 2/17/06, Ludek Finstrle wrote:
> > Are you both using same psqlODBC driver (version ant type - ANSI vs.
> > Unicode)?
>
> That was it! She had it set to ANSI and mine (and the database) is
> Unicode. Changing hers to unicode fixes it. Thanks!
>
> It would be nice if the driver could give a more informative error
> message if this happens, though. I never would have guessed that
> would cause a problem like this.

I tried only some shots into dark. I have no idea what's happen.
Are you able simulate the problem on your computer? Or even better
could you create minimalistic application which reproduce the problem
and send it to me?

Regards,

Luf

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Re: psqlODBC generating incorrect SQL?

am 23.02.2006 14:50:23 von Michael Shulman

Yes, it is very simple. Just create a Unicode database and then try
to connect to it from an ANSI data source.

On 2/17/06, Ludek Finstrle wrote:
> Fri, Feb 17, 2006 at 09:41:07AM -0600, Michael Shulman napsal(a):
> > On 2/17/06, Ludek Finstrle wrote:
> > > Are you both using same psqlODBC driver (version ant type - ANSI vs.
> > > Unicode)?
> >
> > That was it! She had it set to ANSI and mine (and the database) is
> > Unicode. Changing hers to unicode fixes it. Thanks!
> >
> > It would be nice if the driver could give a more informative error
> > message if this happens, though. I never would have guessed that
> > would cause a problem like this.
>
> I tried only some shots into dark. I have no idea what's happen.
> Are you able simulate the problem on your computer? Or even better
> could you create minimalistic application which reproduce the problem
> and send it to me?
>
> Regards,
>
> Luf
>

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster