Unix Technical Forum

Value truncation on user defined type

This is a discussion on Value truncation on user defined type within the pgsql Interfaces odbc forums, part of the PostgreSQL category; --> I've finally taken the plunge and upgraded PgODBC from 7.03.02.00 to 8.02.04.00 ... I'm having an issue with data ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces odbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 05:18 PM
CG
 
Posts: n/a
Default Value truncation on user defined type

I've finally taken the plunge and upgraded PgODBC from 7.03.02.00 to 8.02.04.00 ... I'm having an issue with data truncation on the uniqueidentifier type (http://gborg.postgresql.org/project/...rojdisplay.php) ...


'in ASP vbScript....

dim conn, sql, rs, newUUID
set conn = server.createobject("adodb.connection")
conn.open("Provider=MSDASQL.1;Password=pass;Persis t Security Info=True;User Id=user;Mode=ReadWrite;" & _
"Extended Properties=""DRIVER={PostgreSQL ANSI};" & _
"DATABASE=data;SERVER=10.0.0.2;PORT=5432;UID=user; PWD=pass;" & _
"SSLmode=disable;ReadOnly=0;Protocol=7.4-1;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;" & _
"ShowSystemTables=0;ConnSettings=set+sort%5Fmem%3D 10241%3Bset+geqo%3Don%3B;Fetch=300;Socket=4096;" & _
"UnknownSizes=0;MaxVarcharSize=254;" & _
"MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimiz er=1;Ksqo=1;UseDeclareFetch=0;TextAsLongVarchar=1; " & _
"UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;Can celAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFConve rsion=1;" & _
"UpdatableCursors=1;DisallowPremature=0;TrueIsMinu s1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrep are=1;" & _
"LowerCaseIdentifier=0;XaOpt=1""")

sql = "select newid() as uuid;"

set rs = conn.execute(sql)
newUUID = rs("uuid").value

response.write ("Length : " & len(newUUID) & "<BR>" & vbcrlf)
response.write ("Type : " & vartype(newUUID) & "<BR>" & vbcrlf)
response.write ("<table border=""1"">")
for i = 1 to len(newUUID)
response.write ("<tr><td>" & asc(mid(newUUID,i,1)) & "</td><td>" & server.htmlencode(mid(newUUID,i,1)) & "</td></tr>" & vbcrlf)
next
response.write ("</table>")

rs.close
set rs = nothing
conn.close
set conn = nothing

The returned value is the correct length, but there must be a null inserted after the 16th character becasuse the return value, which is a string type, abruptly terminates at that point.

If I cast the uuid to type text, nothing gets truncated. This wasn't a problem in 7.03.02.00 ...



__________________________________________________ __________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/...ail_tools.html

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 05:18 PM
Hiroshi Inoue
 
Posts: n/a
Default Re: Value truncation on user defined type

Could you send me directly the Mylog output ?

regards,
Hiroshi Inoue

CG wrote:
> I've finally taken the plunge and upgraded PgODBC from 7.03.02.00 to 8.02.04.00 ... I'm having an issue with data truncation on the uniqueidentifier type (http://gborg.postgresql.org/project/...rojdisplay.php) ...
>
>
> 'in ASP vbScript....
>
> dim conn, sql, rs, newUUID
> set conn = server.createobject("adodb.connection")
> conn.open("Provider=MSDASQL.1;Password=pass;Persis t Security Info=True;User Id=user;Mode=ReadWrite;" & _
> "Extended Properties=""DRIVER={PostgreSQL ANSI};" & _
> "DATABASE=data;SERVER=10.0.0.2;PORT=5432;UID=user; PWD=pass;" & _
> "SSLmode=disable;ReadOnly=0;Protocol=7.4-1;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;" & _
> "ShowSystemTables=0;ConnSettings=set+sort%5Fmem%3D 10241%3Bset+geqo%3Don%3B;Fetch=300;Socket=4096;" & _
> "UnknownSizes=0;MaxVarcharSize=254;" & _
> "MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimiz er=1;Ksqo=1;UseDeclareFetch=0;TextAsLongVarchar=1; " & _
> "UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;Can celAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFConve rsion=1;" & _
> "UpdatableCursors=1;DisallowPremature=0;TrueIsMinu s1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrep are=1;" & _
> "LowerCaseIdentifier=0;XaOpt=1""")
>
> sql = "select newid() as uuid;"
>
> set rs = conn.execute(sql)
> newUUID = rs("uuid").value
>
> response.write ("Length : " & len(newUUID) & "<BR>" & vbcrlf)
> response.write ("Type : " & vartype(newUUID) & "<BR>" & vbcrlf)
> response.write ("<table border=""1"">")
> for i = 1 to len(newUUID)
> response.write ("<tr><td>" & asc(mid(newUUID,i,1)) & "</td><td>" & server.htmlencode(mid(newUUID,i,1)) & "</td></tr>" & vbcrlf)
> next
> response.write ("</table>")
>
> rs.close
> set rs = nothing
> conn.close
> set conn = nothing
>
> The returned value is the correct length, but there must be a null inserted after the 16th character becasuse the return value, which is a string type, abruptly terminates at that point.
>
> If I cast the uuid to type text, nothing gets truncated. This wasn't a problem in 7.03.02.00 ...


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 05:19 PM
Hiroshi Inoue
 
Posts: n/a
Default Re: Value truncation on user defined type

I wrote:
> Could you send me directly the Mylog output ?


I seem to have found the cause.
Please try the drivers on testing for 8.2.0402 at
http://www.geocities.jp/inocchichich...dbc/index.html .


> CG wrote:
>> I've finally taken the plunge and upgraded PgODBC from 7.03.02.00 to 8.02.04.00 ... I'm having an issue with data truncation on the uniqueidentifier type (http://gborg.postgresql.org/project/...rojdisplay.php) ...
>>


regards,
Hiroshi Inoue


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:26 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com