From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: Christian Cryder <c.s.cryder@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Timestamp Conversion Woes Redux
Date: Tue, 19 Jul 2005 10:34:11 -0400
Message-ID: <23729.1121783651@sss.pgh.pa.us> (raw)
In-Reply-To: <42DD0824.9060002@opencloud.com>
References: <90876a9e05071810503606d431@mail.gmail.com>
<16335.1121714809@sss.pgh.pa.us>
<10C90079-DD0A-43D7-9389-7486803F0AB1@fastcrypt.com>
<42DC37AC.5030704@opencloud.com>
<C36F2D5F-093E-489C-8D6F-A67B746EA6C8@fastcrypt.com>
<42DCF0C9.4030501@opencloud.com>
<23396.1121781259@sss.pgh.pa.us>
<42DD0824.9060002@opencloud.com>
Oliver Jowett <oliver@opencloud.com> writes:
> The main thing I'm worried about there is that if there are cases where
> an UNKNOWN parameter will generate an error rather than resolve to TEXT,
> then the driver has just backed the user into a corner they can't escape
> from. Are there any cases where this can happen?
There are some, for instance someone was just complaining about this:
template1=# select 1 where 5 in (select '');
ERROR: failed to find conversion function from "unknown" to integer
My previous response was based on what was in my inbox, which I now see
wasn't the whole thread. I agree with you that if we make setString
default to UNKNOWN, there had better be a way to say "by golly this
really is TEXT" for the corner cases. It'd be a good idea if it wasn't
limited to TEXT, either, but could allow specification of any random
datatype.
I believe that UNKNOWN will work fine for 99% of cases out there,
because the backend's algorithms have been tuned for years to generally
do the right thing when presented with unadorned literal strings ---
but there has to be an escape hatch for the other 1%.
Of course, there's always the escape hatch of changing the query text,
that is write
select ... cast(? as text)
or
select ... ?::text
but this seems pretty crude.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, oliver@opencloud.com, pg@fastcrypt.com, c.s.cryder@gmail.com
Subject: Re: Timestamp Conversion Woes Redux
In-Reply-To: <23729.1121783651@sss.pgh.pa.us>
References: <90876a9e05071810503606d431@mail.gmail.com> <16335.1121714809@sss.pgh.pa.us> <10C90079-DD0A-43D7-9389-7486803F0AB1@fastcrypt.com> <42DC37AC.5030704@opencloud.com> <C36F2D5F-093E-489C-8D6F-A67B746EA6C8@fastcrypt.com> <42DCF0C9.4030501@opencloud.com> <23396.1121781259@sss.pgh.pa.us> <42DD0824.9060002@opencloud.com> <23729.1121783651@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox