Subject: DataRow message for Integer(int4) returns result as text?

From: Tyler Brock <[email-masked]>
Date: Wed, 20 Apr 2022 23:39:15 +0000

I think this makes sense but I wanted to get confirmation:

I created a table with a column having the type int4 (integer). When I
insert a row with a number into that column and get it back out I've
observed a discrepancy:

The DataRow message has the field encoded as an ASCII ‘7’ with a column
length of 1 despite the RowDescription having a column length 4. I assume
that this is because it’s a simple query (Q) and therefore the format code
for all columns is 0 (for text format).

It makes sense that at the time the RowDescription is written out that it
can’t possibly know how many bytes the textual representation of each int
will take so it just uses the length of the underlying type.

Is this accurate?

-Tyler