Обсуждение: psqlODBC generating incorrect SQL?
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=160249744, query='UPDATE "public"."application" SET "decision"=Accepted 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"=? 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
> 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
On 2/17/06, Ludek Finstrle <luf@pzkagis.cz> 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
Fri, Feb 17, 2006 at 09:41:07AM -0600, Michael Shulman napsal(a): > On 2/17/06, Ludek Finstrle <luf@pzkagis.cz> 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
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 <luf@pzkagis.cz> wrote: > Fri, Feb 17, 2006 at 09:41:07AM -0600, Michael Shulman napsal(a): > > On 2/17/06, Ludek Finstrle <luf@pzkagis.cz> 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 >