Re: mssql to postgres problems with bytea help needed - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: mssql to postgres problems with bytea help needed
Date
Msg-id fqp2ab$53j$1@ger.gmane.org
Whole thread Raw
In response to mssql to postgres problems with bytea help needed  (robert <robertlazarski@gmail.com>)
Responses Re: mssql to postgres problems with bytea help needed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
robert, 06.03.2008 15:32:
> Hi all,
>
> I've successfully converted a huge mssql ddl to postgres 8.1.9 - I
> could upgrade if need be. We run both db's for our app depending on
> the customer. We have a new feature, storing serialized java objects
> in the db, and I'm having trouble with on this insert:
>
> INSERT INTO
> "FUND_ASSET_DTO_BINARY"
("fundAssetDTOBinaryID",OBJ_VERSION,"binaryFundAssetDTO")VALUES(1,0,0xACED000573720028636F6D2E77617A6F6C6C632E616C7068617468656F72792E64746F2E46756E64417373657444544F000000000000000102005E4C000F61637475616C436F737442617369737400124C6A6176612F6C616E672F446F75626C653B4C001361637475616C43757272656E7453686172657371007E00014C0014616E616C79736973436F6E666964656E636549447400104C6A6176612F6C616E672F4C6F6E673B4C0009616E616C797374494471007E00024C001061737365744176674461696C79566F6C71007E00014C000961737365744265746171007E00014C0011617373657445786368616E67655261746571007E00014C0011617373657446696C654C6973744A534F4E74001E4C636F6D2F69736F6D6F72706869632F6A732F4A534F4E46696C7465723B4C00076173736574494471007E00024C000F617373657449646561536F757263657400124C6A6176612F6C616E672F537472696E673B4C000961737365744E616D6571007E00044C000A61737365744E6F74657371007E00044C001161737365745363656E6172696F4C6973747400104C6A6176612F7574696C2F4C6973743B4C001561737365745363656E6172696

F4C6973744A534F4E71007E00034C000B6173736F6369617465494471007E00024C000A63617465676F7279494471007E00024C0009636F6D70616E79494471007E00024C0009636F7374426173697371007E00014C000C63757272656E74507269636571007E00014C000D63757272656E7453686172657371007E00014C000C6465706172746D656E74494471007E00024C000E65786368616E676541636365737371007E00044C000F666574636841737365744E616D65737400134C6A6176612F6C616E672F426F6F6C65616E3B4C0015666978656441737365744176674461696C79566F6C71007E00014C000E666978656441737365744265746171007E00014C00166669786564417373657445786368616E67655261746571007E00014C000E66697865644173736574466C616771007E00064C000E666978656441737365744E616D6571007E00044C000F66697865644173736574507269636571007E00014C000B66756E6441646D696E494471007E00024C001566756E64416E6E75616C697A6552657475726E494471007E00024C000B66756E644173736574494471007E00024C001D66756E6441737365745472616465486973746F72794C6973744A534F4E71007E00034C000B66756E644265746141646A71007E00064C001566756E644578706563746564526

57475726E41646A71007E00064C000666756E64494471007E00024C001066756E644D6178496E7655707369646571007E00014C000E66756E644D61784C6F6E67496E7671007E00014C000F66756E644D617853686F7274496E7671007E00014C000E66756E644D696E4C6F6E67496E7671007E00014C001166756E644D696E52657475726E4C6F6E6771007E00014C001266756E644D696E52657475726E53686F727471007E00014C000F66756E644D696E53686F7274496E7671007E00014C000D66756E644D696E566F6C756D6571007E00014C001166756E645063744368616E67654C6F737371007E00014C000F66756E6450637446756E644C6F737371007E00014C001666756E64506F7274666F6C696F4D616E61676572494471007E00024C001766756E6450726566657272656452657475726E4C6F6E6771007E00014C001866756E6450726566657272656452657475726E53686F727471007E00014C001366756E64507265666572726564566F6C756D6571007E00014C001466756E645265696E766573746D656E745261746571007E00024C001566756E64526573747269637469766541636365737371007E00064C001466756E645361666574794D617267696E4C6F6E6771007E00014C001566756E645361666574794D617267696E53686F727471007E00014

C001266756E645472616465416C6572744C6F6E6771007E00024C001366756E645472616465416C65727453686F727471007E00024C000966756E6456616C756571007E00014C000D66756E64566F6C756D6541646A71007E00064C000E6C6F6164416C6C4F626A6563747371007E00064C00116D6178506F736974696F6E526561736F6E71007E00044C000F6D6178506F736974696F6E53697A6571007E00014C000B70726F626162696C69747971007E00024C00167265737472696374697665416363657373436865636B71007E00064C000C7361666574794D617267696E71007E00014C000D7363656E6172696F4E616D653171007E00044C000D7363656E6172696F4E616D653271007E00044C000D7363656E6172696F4E616D653371007E00044C000D7363656E6172696F4E616D653471007E00044C000D7363656E6172696F4E616D653571007E00044C000E7363656E6172696F4E6F7465733171007E00044C000E7363656E6172696F4E6F7465733271007E00044C000E7363656E6172696F4E6F7465733371007E00044C000E7363656E6172696F4E6F7465733471007E00044C000E7363656E6172696F4E6F7465733571007E00044C000B7363656E6172696F50543171007E00014C000B7363656E6172696F50543271007E00014C000B7363656E6172696F505

43371007E00014C000B7363656E6172696F50543471007E00014C000B7363656E6172696F50543571007E00014C000D7363656E6172696F50726F623171007E00024C000D7363656E6172696F50726F623271007E00024C000D7363656E6172696F50726F623371007E00024C000D7363656E6172696F50726F623471007E00024C000D7363656E6172696F50726F623571007E00024C00117363656E6172696F734D6F6469666965647400104C6A6176612F7574696C2F446174653B4C000973686172654269617371007E00014C0013736861726573507572636861736564436F737471007E00014C000E736861726573536F6C64436F737471007E00014C0008737461747573494471007E00024C00067469636B657271007E00044C0008747261646572494471007E00024C000E7472616465734D6F64696669656471007E00074C000A7669657755736572494471007E00024C000C7761736852756C654461746571007E00077870707070707070707070707070707070707070707070707070707070707070707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000170707070707070707070707070707070707070707070707
07070707070707070707070707070707070707070707070707070707070707070707070707070);
>
> If that line is not showing up on your newsreader, please see this
> link:
>
> http://braziloutsource.com/random/postgres_bytea_problem.txt
>
> When inserting, I get: ERROR:  syntax error at or near "xACED0005
> <snip>
>
> I've been googling / reading the docs and I tried several things that
> have not worked, but thought I'd post here while I'm trying solutions.
> Any ideas? I'm open to any cast or modifying the insert to use psql
> functions, etc.

The syntax for specifying "BLOB literals" is a bit different in Postgres. You need to encode the bytes as octal values
nothex values.  

See: http://www.postgresql.org/docs/8.2/static/datatype-binary.html

INSERT INTO "FUND_ASSET_DTO_BINARY"
("fundAssetDTOBinaryID', OBJ_VERSION, "binaryFundAssetDTO")
VALUES
(1, 0, \254\355\00 ... )

Btw: are you sure you want to use case-sensitive table and column names? This usually causes more trouble than it's
worth.But that's just my opinion. 

Thomas

pgsql-general by date:

Previous
From: robert
Date:
Subject: mssql to postgres problems with bytea help needed
Next
From: js@deriva.de
Date:
Subject: Violation of non existing reference