Re: BUG #1904: using distinct with null col causes error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Brian Cox" <bcox(at)timestock(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1904: using distinct with null col causes error
Date: 2005-09-22 15:35:17
Message-ID: 29251.1127403317@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Brian Cox" <bcox(at)timestock(dot)com> writes:
> any_db=> create view view1 as select null as col1 from any_table;
> CREATE VIEW

You seem to have ignored the warning telling you this probably wasn't
a good idea:

regression=# create view view1 as select null as col1;
WARNING: column "col1" has type "unknown"
DETAIL: Proceeding with relation creation anyway.
CREATE VIEW
regression=#

According to the letter of the SQL standard, the above is illegal;
you're really supposed to CAST the null to some specific datatype.
If we were to change anything in response to this complaint, it'd
probably be to promote the WARNING to an ERROR.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Treat 2005-09-22 16:00:08 Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.
Previous Message Tom Lane 2005-09-22 15:23:04 Re: possible bug...