Tyler Brock <tyler.br...@gmail.com> writes: > 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). If you mean the "data type size" (typlen) field of RowDescription, that is arguably completely irrelevant; it's there for historical reasons, I think. The contents of a DataRow field will either be a textual conversion of the value or the on-the-wire binary representation defined by the type's typsend routine. In either case, the actual length of the value as it appears in DataRow is given right there in the DataRow message. And in either case, the typlen value doesn't necessarily have anything to do with the length of the DataRow representation. typlen does happen to match up with the length that'd appear in DataRow for simple integral types sent in binary format ... but for other cases, not so much. regards, tom lane