Re: The Tomb of the Unknown Type?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: The Tomb of the Unknown Type?
Date: 2004-04-09 05:05:05
Message-ID: 21118.1081487105@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chris Browne <cbbrowne(at)acm(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-04-09 05:11:04 Re: Small suggestion on build script
Previous Message Tom Lane 2004-04-09 04:43:20 Re: PostgreSQL configuration