Re: The Tomb of the Unknown Type? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: The Tomb of the Unknown Type?
Date
Msg-id 21118.1081487105@sss.pgh.pa.us
Whole thread Raw
In response to The Tomb of the Unknown Type?  (Chris Browne <cbbrowne@acm.org>)
List pgsql-hackers
Chris Browne <cbbrowne@acm.org> writes:
> We have encountered a pretty oddball situation involving an "unknown" type.

The way you get this sort of thing is with

CREATE VIEW foo AS SELECT ... , 'literal', ...

The undecorated literal is initially of type UNKNOWN, and there's
nothing to cause it to get coerced to some more-specific type, so
UNKNOWN ends up actually showing in the view's column type.  The
CREATE command will bleat ineffectually about this, but create the
view anyway.

The cure is to cast the literal to some specific type when you
do the CREATE.

One could perhaps argue that we should default to assuming that TEXT
type was meant, as we do in some similar cases such as UNION.  But
it's not done at the moment.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL configuration
Next
From: Tom Lane
Date:
Subject: Re: Small suggestion on build script