DataRow message for Integer(int4) returns result as text? - Mailing list pgsql-hackers

From Tyler Brock
Subject DataRow message for Integer(int4) returns result as text?
Date
Msg-id CACr_h8QSz4k9KckE7MTspYnHbkLLKmM0WyvfNpWzVF50SZMoPw@mail.gmail.com
Whole thread Raw
Responses Re: DataRow message for Integer(int4) returns result as text?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: DataRow message for Integer(int4) returns result as text?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)
Next
From: "David G. Johnston"
Date:
Subject: doc: New cumulative stats subsystem obsoletes comment in maintenance.sgml