Insert path fails
Insert path fails
От:
Steven Sluter <loverman@sidehack.gweep.net>
Дата:
Hello-
I am running PostgreSQL 7.2.1 on i386-portbld-freebsd4.6. I'm connecting
from a program on windows nt 4.0, using the 7.02.00.05 ver. of PGSQL-ODBC
drivers.
When I try to insert a windows UNC path:
\\RAID\Raid\control tiffs\50_gray.tif
into the database, I end up with this:
\RAIDRaidcontrol tiffs(_gray.tif
Here is the relevent stuff from the psqlodbc file:
conn=215355400, query='Insert Into
Images(OrderID,Roll,Frame,ImageType,Path,Category,Sequence,Gamma,Width,
Length,Filetype,PreviewWidth,PreviewLength,CropX,CropY,CropWidth,CropLength)
Values('me','control tiffs','50_gray',0,'\\RAID\Raid\control tiffs\50_gray.tif'
,'All',0,1.0,2000,2500,'TIFF',400,500,50.0,50.0,100.0,100.0)'
Why does this insert the wrong value into the database?
Thanks
-Steve
Re: Insert path fails
От:
"Hiroshi Inoue" <Inoue@tpf.co.jp>
Дата:
> -----Original Message----- > From: Steven Sluter > > Hello- > > I am running PostgreSQL 7.2.1 on i386-portbld-freebsd4.6. I'm connecting > from a program on windows nt 4.0, using the 7.02.00.05 ver. of PGSQL-ODBC > drivers. > > When I try to insert a windows UNC path: > > \\RAID\Raid\control tiffs\50_gray.tif > > > into the database, I end up with this: > > \RAIDRaidcontrol tiffs(_gray.tif It's a spec of PostgreSQL. The ODBC driver passes the query as is. regards, Hiroshi Inoue
Re: Insert path fails
От:
Jeff Eckermann <jeff_eckermann@yahoo.com>
Дата:
--- Steven Sluter wrote: > Hello- > > I am running PostgreSQL 7.2.1 on > i386-portbld-freebsd4.6. I'm connecting > from a program on windows nt 4.0, using the > 7.02.00.05 ver. of PGSQL-ODBC > drivers. > > When I try to insert a windows UNC path: > > \\RAID\Raid\control tiffs\50_gray.tif > > > into the database, I end up with this: > > \RAIDRaidcontrol tiffs(_gray.tif The backslash is an escape character in PostgreSQL, and is stripped off at parsing time. Your alternatives are: * Double every backslash you want to preserve, i.e. \\\\RAID\\Raid\\control tiffs\\50_gray.tif * Add extra quotes (a mess, don't even try it) * Use the quote_literal() function, which causes PostgreSQL to accept the text as-is: e.g. INSERT INTO