Jump to content
mLipok

PostgreSQL: pgAdmin III different result in ADO

Recommended Posts

mLipok

I'm using this SQL Statement in pgAdmin III :

Select REVERSE(DECODE(
'0A464F4525250A3231380A6665727874726174730A3E3E0A522030203920746F6F522F20303120657A69532F203C3C0A72652F4E616D652F46312F42617365466F6E742F48656C7665746963612F456E636F64696E672F57696E416E7369456E636F64696E673E3E0A656E646F626A0A322030206F626A0A3C3C2F547970652F466F6E742F537562747970652F54797065312F4E616D652F46322F42617365466F6E742F48656C7665746963612D426F6C642F456E636F64696E672F57696E416E7369456E636F64696E673E3E0A656E646F626A0A332030206F626A0A3C3C2F547970652F466F6E742F537562747970652F54797065312F4E616D652F46332F42617365466F6E742F48656C7665746963612D4F626C697175652F456E636F64696E672F57696E416E7369456E636F64696E673E3E0A656E646F626A0A342030206F626A0A3C3C2F547970652F466F6E742F537562747970652F54797065312F4E616D652F46342F42617365466F6E742F48656C7665746963612D426F6C644F626C697175652F456E636F64696E672F57696E416E7369456E636F64696E673E3E0A656E646F626A0A352030206F626A0A3C3C2F4C656E6774682035333E3E0A73747265616D0A425420312030203020312037322037363220546D0A2F46312031312054662030203020302072672030202D31332E322054440A45540A656E6473747265616D0A656E646F626A0A362030206F626A0A3C3C2F50726F635365745B2F5044462F546578745D0A2F466F6E743C3C2F46312031203020522F46322032203020522F46332033203020522F46342034203020523E3E203E3E0A656E646F626A0A372030206F626A0A3C3C2F547970652F506167652F506172656E742038203020520A2F4D65646961426F785B2030203020353935203834325D0A2F436F6E74656E74732035203020520A2F5265736F75726365732036203020520A3E3E0A656E646F626A0A382030206F626A0A3C3C2F547970652F50616765732F4B6964735B0A37203020520A5D2F436F756E7420310A3E3E0A656E646F626A0A392030206F626A0A3C3C2F547970652F436174616C6F672F5061676573203820302052203E3E0A656E646F626A0A787265660A302031300A303030303030303030302036353533352066200A30303030303030303135203030303030206E200A30303030303030313131203030303030206E200A30303030303030323132203030303030206E200A30303030303030333136203030303030206E200A30303030303030343234203030303030206E200A30303030303030353235203030303030206E200A30303030303030363131203030303030206E200A30303030303030373132203030303030206E200A30303030303030373636203030303030206E200A747261696C31657079542F657079746275532F746E6F462F657079542F3C3C0A6A626F203020310AA28FECC7250A332E312D46445025'
,'HEX')::TEXT)

And I get this results:

Quote

"%PDF-1.3210\%703\453\712\242\210\1 0 obj210\<</Type/Font/Subtype/Type1liart210\ n 00000 6670000000210\ n 00000 2170000000210\ n 00000 1160000000210\ n 00000 5250000000210\ n 00000 4240000000210\ n 00000 6130000000210\ n 00000 2120000000210\ n 00000 1110000 (...)"

For my needs this is correct results.

But When I use the same SQL Statement with AutoIt + ADO then I get this kind of results:

Quote

52054464d213e233a0527ccef82aa013020302f626a6a0c3c3f2459...... 

but In hex this should be like this:

Quote

255044462D312E333231305C253730335C3435335C37........

52>25
05>50
44>44
64>46
d2>2d
...
...

 

QUESTIONS:

Does anyone know the reason for the difference between the pgAdmin III and ADO?
How to solve this problem ? (  I need to get in ADO the same results like currently in pgAdmin III )

 

Regards,
mLipok

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-15

Share this post


Link to post
Share on other sites
mLipok

I got answer:
" The described behavior is managed by the 'bytea_output' PostgreSQL configuration parameter, which can be set for a session as well. PgAdminIII seems to override its default value ('hex') to the 'escape' one. "

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-15

Share this post


Link to post
Share on other sites
jchd

Vicious!  I wonder what's the rationale behind swapping nibbles by default.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
mLipok
8 minutes ago, jchd said:

Vicious! 

Who is ?


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-15

Share this post


Link to post
Share on other sites
Skysnake
reverse                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 52054464d213e233a0527ccef82aa013020302f626a6a0c3c3f245970756f264f6e647f235572647970756f24597075613c696162747a002e60203030303030263637303030303030303a002e60203030303030223137303030303030303a002e60203030303030213136303030303030303a002e60203030303030253235303030303030303a002e60203030303030243234303030303030303a002e60203030303030263133303030303030303a002e60203030303030223132303030303030303a002e60203030303030213131303030303030303a002e60203030303030253130303030303030303a002660253335353630203030303030303030303a003130203a066562787a0a626f646e656a0e3e3022502030283023756761605f276f6c616471634f256079745f2c3c3a0a626f602030293a0a626f646e656a0e3e3a0130247e657f634f2d5a02502030273a0b5374696b4f23756761605f256079745f2c3c3a0a626f602030283a0a626f646e656a0e3e3a02502030263023756362757f6375625f2a02502030253023747e65647e6f634f2a0d5234383025393530203020302b587f62416964656d4f2a025020302830247e656271605f256761605f256079745f2c3c3a0a626f602030273a0a626f646e656a0e3e302e3e32502030243024364f22502030233023364f22502030223022364f22502030213021364f2c3c347e6f664f2a0d547875645f2644405f2b547563536f62705f2c3c3a0a626f602030263a0a626f646e656a0d6165627473746e656a04554a044450223e23313d20203027627020302030203026645021313021364f2a0d645022363730223730213020302030213024524a0d61656274737a0e3e3335302864776e656c4f2c3c3a0a626f602030253a0a626f646e656a0e3e376e69646f636e6549637e614e69675f276e69646f636e654f256571796c626f446c6f624d2163696475667c65684f247e6f66456371624f24364f256d616e4f21356079745f256079747265735f247e6f664f256079745f2c3c3a0a626f602030243a0a626f646e656a0e3e376e69646f636e6549637e614e69675f276e69646f636e654f256571796c626f4d2163696475667c65684f247e6f66456371624f23364f256d616e4f21356079745f256079747265735f247e6f664f256079745f2c3c3a0a626f602030233a0a626f646e656a0e3e376e69646f636e6549637e614e69675f276e69646f636e654f246c6f624d2163696475667c65684f247e6f66456371624f22364f256d616e4f21356079745f256079747265735f247e6f664f256079745f2c3c3a0a626f602030223a0a626f646e656a0e3e376e69646f636e6549637e614e69675f276e69646f636e654f2163696475667c65684f247e6f66456371624f21364f256d616e4f25627a0c3c302f23596a75602130302f225f6f647029302030225a0e3e3a0374716274787275666a0831323a0525254f464a0x\
(1 row)

 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
Skysnake

Sorry. I can't seem to get the previous post edited.

I took the above SELECT and put it into hex.sql, executed like this

psql < hex.sql

It returned the result above. 

 

Why is this important?

It means pgAdmin3 does something ... wrong...

while ADO and psql (the default command line tool) return the same result.

Problem is not with ADO. Problem is with pgAdmin3. :)

@mLipok to get the same results from psql you probably need to set some kind of variable to the same value that pgAdmin3 uses. I do not know where or how.  

I hope this helps.

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×