binary format of array stored as text - Mailing list pgsql-general

From Dave Huber
Subject binary format of array stored as text
Date
Msg-id 7CDADB576E07AC4FA71E1B12566C9126540E0A0C26@lti-mb-1.LTI.com
Whole thread Raw
Responses Re: binary format of array stored as text
List pgsql-general

I have an old table with a column specified as integer[]. The data within this column was stored as text ala {1,2,3,…} yada yada. I have an application where I am reading all the columns from a row in this table in binary format. Does anybody know how I can recast/reshape this binary data back into an array of integers?

 

The array in text format is:

{0,3,3,18,19,19,35,35}

 

The array in binary format is:

0000 0001 0000 0000 0000 0017 0000 0008

0000 0001 0000 0004 0000 0000 0000 0004

0000 0003 0000 0004 0000 0003 0000 0004

0000 0012 0000 0004 0000 0013 0000 0004

0000 0013 0000 0004 0000 0023 0000 0004

0000 0023

 

I can make some assumptions to interpet “0000 0004 0000 0023” as a 32-bit length followed by length bytes (length = 4, data = 0x23 = 35), but I have no clue how to interpret the leading 20 bytes of this data.

 

I appreciate any help I can get.

 

Thanks,

Dave Huber



This electronic mail message is intended exclusively for the individual(s) or entity to which it is addressed. This message, together with any attachment, is confidential and may contain privileged information. Any unauthorized review, use, printing, retaining, copying, disclosure or distribution is strictly prohibited. If you have received this message in error, please immediately advise the sender by reply email message to the sender and delete all copies of this message.
THIS E-MAIL IS NOT AN OFFER OR ACCEPTANCE: Notwithstanding the Uniform Electronic Transactions Act or any other law of similar import, absent an express statement to the contrary contained in this e-mail, neither this e-mail nor any attachments are an offer or acceptance to enter into a contract, and are not intended to bind the sender, LeTourneau Technologies, Inc., or any of its subsidiaries, affiliates, or any other person or entity.
WARNING: Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

pgsql-general by date:

Previous
From: Gordon Ross
Date:
Subject: Re: PL/SQL & unset custom variable
Next
From: Sergey Samokhin
Date:
Subject: Should I create an index for partition with fixed key?