473,394 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

parsing binary varchar[]-s

Hi,

I use binary mode for sending params and receiving data using libpq with
protocol v3; PostgreSQL version is 7.4.3.
Here, varchar[]-s are returned in binary mode; they're generated from internal
structs by "array_send" function in src/backend/utils/adt/arrayfuncs.c.
PQftype(..) returns 1015 for those columns. I couldn't find any #define for
this OID -- does this mean it can change in future pg releases ? Also, can I
safely use the binary format as described (by the code) in "array_send" ? Is
this interface is frozen, as a part of protocol v3 spec ?

--
Best Regards,
Igor Shevchenko

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #1
1 1555
Igor Shevchenko <ig**@carcass.ath.cx> writes:
I use binary mode for sending params and receiving data using libpq with
protocol v3; PostgreSQL version is 7.4.3.
Here, varchar[]-s are returned in binary mode; they're generated from internal
structs by "array_send" function in src/backend/utils/adt/arrayfuncs.c.
PQftype(..) returns 1015 for those columns. I couldn't find any #define for
this OID -- does this mean it can change in future pg releases ?
It's "_varchar" in pg_type.h, and no the OID is not likely to change.
(Any OID under 10000 is manually assigned and we would have to go out
of our way to change it.)
Also, can I safely use the binary format as described (by the code) in
"array_send" ? Is this interface is frozen, as a part of protocol v3
spec ?


Yes, the intention is that those formats are frozen. We haven't gotten
around to collecting the information in a document, so you have to look
at the code, but it's supposed to not change.

At least up to a point ;-). Sooner or later we are going to want to
support null elements within arrays, and that will surely impact the
internal format as well as the transmitted format. My guess is that
arrays that do not contain any nulls will look the same as now, but
if there are nulls then a bit will be set in the flags word and we'll
insert a null bitmap someplace. So I'd strongly recommend checking the
flags word and punting if it contains a value you do not recognize.

regards, tom lane

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

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: AK | last post by:
Once upon a time there was a table: CREATE TABLE VENDOR(VENDOR_ID INT, NAME VARCHAR(50), STATE CHAR(2))@ in a while the developers realized that a vendor may be present in xseveral states, so...
4
by: Hazzard | last post by:
What is the best way to do this? Binary with 0 representing off and 1 on? Int16 with 1 representing first button, 2 the second, 3 ... varchar with a character values at certain positions in the...
0
by: earsypaul | last post by:
Hello, With MS SQL server we can bcp hexadecimal data into varbinary columns quite nicely. We're migrating some data to DB2 and trying to import to a "varchar for bit data" data type column....
3
by: Cuong.Tong | last post by:
Greeting, I am writing my own web server and having some problme parsing the the mulitpart/form-data stream that is sent from the browsers. I have a form looks something like this <form...
10
by: nicenjguy | last post by:
This is my problem Table 1 is a list of reports that have the following columns Report ID, Report Name, Groups Allowed, Roles Allowed 1 Report 1 Clerk, Mgr ...
5
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I am having a problem converting string to binary and I am hoping someone can help me out I have a sql query that does an update that updates a binary field calles password ...
12
radcaesar
by: radcaesar | last post by:
Hi, I am reading a xml file using T-SQL. I want the xml data to use in openxml. So i was using cursor here. Here i am concatenating the xml data into a variable called @FileContents. When i print...
31
by: broli | last post by:
I need to parse a file which has about 2000 lines and I'm getting told that reading the file in ascii would be a slower way to do it and so i need to resort to binary by reading it in large...
17
by: anojjona | last post by:
Hi, I need to figure out what some code that was maliciously executed against a database does. However, it's in a very strange format. It simply declares a variable and sets it equal to a huge...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.