Re: Problem with fixed length fields. - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Problem with fixed length fields.
Date
Msg-id 417AC2C2.40605@opencloud.com
Whole thread Raw
In response to Re: Problem with fixed length fields.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Problem with fixed length fields.
List pgsql-jdbc
Tom Lane wrote:
> Kris Jurka <books@ejurka.com> writes:
>
>>This is a problem with the driver because it is typing the '  ' values as
>>text, not char, so the comparison doesn't work right because these two
>>types handle trailing spaces differently.
>
>
> Can you refrain from assigning a type at all?  People writing the
> equivalent SQL directly would almost always write 'foo', not
> 'foo'::text or 'foo'::char.  The parser's behavior has been tuned
> so that that usually works nicely.

We've been trying to avoid that as there is currently no statement
Describe issued by the driver, so we'd run the risk that the parser
would infer something completely unexpected from the driver's point of
view. Also, we'd need the Describe to get useful information on when a
named statement can be safely reused (the driver currently gets this
wrong anyway, but it's fixable without needing a Describe as it stands).

Adding the Describe would add a round-trip to every query that involved
an unknown type.

Pushing on blindly with a Bind without knowing the actual type of the
parameters you're sending seems possible but dangerous. It'd preclude
using binary-format parameters for unknown types, at a minimum.

-O

pgsql-jdbc by date:

Previous
From: "Serguei Mokhov"
Date:
Subject: Translation updates: ru.po
Next
From: Tom Lane
Date:
Subject: Re: Problem with fixed length fields.