Thread: Re: [INTERFACES] DBD::Pg installation seems to fail with 7.1 libs

Re: [INTERFACES] DBD::Pg installation seems to fail with 7.1 libs

From
Tom Lane
Date:
Frank Joerdens <frank@joerdens.de> writes:
> [ DBD::Pg fails against current sources with ]
> DBD::Pg::db table_info failed: ERROR:  Unable to identify an ordering
> operator '<' for type 'unknown'

Hmm.  It looks like this is caused by my reimplementation of UNION to
use CASE-style datatype resolution.  The DBD code is fetching table
data with a UNION that includes a couple of untyped literal constants.
Boiled down:

regression=# select 'foo' union select 'bar';
ERROR:  Unable to identify an ordering operator '<' for type 'unknown'       Use an explicit ordering operator or
modifythe query
 

This is bad, since the same query used to work pre-7.1.

The reason it worked is that the old UNION code had an ugly hack to
force such constants to be treated as type text.  There is no such hack
in the datatype unification code right now.

Thomas, you've been muttering about altering the type resolution rules
so that "unknown" will be treated as "text" when all else fails.  Are
you planning to commit such a thing for 7.1?  If not, I'll probably have
to hack up parse_coerce.c's select_common_type(), along the lines of
             }         }     }
+    /* if all inputs are UNKNOWN, treat as text */
+     if (ptype == UNKNOWNOID)
+        ptype = TEXTOID;     return ptype; }


This might be an appropriate change anyway.  Comments?
        regards, tom lane


Re: [INTERFACES] DBD::Pg installation seems to fail with 7.1 libs

From
Thomas Lockhart
Date:
> Thomas, you've been muttering about altering the type resolution rules
> so that "unknown" will be treated as "text" when all else fails.  Are
> you planning to commit such a thing for 7.1?  If not, I'll probably have
> to hack up parse_coerce.c's select_common_type(), along the lines of

I'm *finally* getting several patches together, to do the following
things:

o Fix the type resolution for unknown function arguments to fall back to
"text" or a string type, if available. Previously discussed.

o Implement an AT TIME ZONE clause, per SQL9x. Will handle an INTERVAL
argument, per standard, and also accept a string containing a time zone
spec, per existing PostgreSQL extension. Previously discussed.

o Fix timestamp/interval math across daylight savings time boundaries.
Previously discussed.

o Allow interpretation of "hh:mm:ss" as INTERVAL input. I can't remember
if I've mentioned this one before.

o Fix output of INTERVAL when sign of year/month is different than sign
of hour/min/sec. This is accompanied by changes in the "ISO" form of
output to more closely resemble a "hh:mm:ss" format. I just noticed the
problem today, so have not discussed it on list yet.

o Add some JOIN regression tests. More should be and will be done, but I
don't want to keep holding back patches on this. Per Tom Lane's request.


The only one with some potential for user trouble is the INTERVAL format
change. The old code was wrong, but the format itself has been changed
to be a little more concise.
                      - Thomas