Does the JDBC 4 driver for PG 8.4 escape each character of the bytea type, or does it use a binary protocol?
When sending parameter data to the server, it uses the binary format.
When receiving results from the server, it uses the text format.
Thanks, Oliver. Well, I hadn't even thought it could be both. <smile>
There was confusion in the other replies because they were looking at how the data moves from my code into the driver, but not how the driver communicates with the backend. It was clear I could store binary data as I was doing that just fine, but the PG docs made it sound like much of my binary data would end up expanding because more than half of the range an octet may have requires escaping per
http://www.postgresql.org/docs/8.4/static/datatype-binary.html:Table 8-7. bytea Literal Escaped Octets
Decimal Octet Value | Description | Escaped Input Representation | Example | Output Representation |
---|
0 | zero octet | E'\\000' | SELECT E'\\000'::bytea; | \000 |
39 | single quote | '''' or E'\\047' | SELECT E'\''::bytea; | ' |
92 | backslash | E'\\\\' or E'\\134' | SELECT E'\\\\'::bytea; | \\ |
0 to 31 and 127 to 255 | "non-printable" octets | E'\\xxx' (octal value) | SELECT E'\\001'::bytea; | \001 |
I am thinking this should not be a real issue for me since I will be using LOs for by big objects and BYTEAs for the smaller objects.
Thanks again,
David