dbTalk Databases Forums  

[BUGS] BUG #1904: using distinct with null col causes error

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1904: using distinct with null col causes error in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brian Cox
 
Posts: n/a

Default [BUGS] BUG #1904: using distinct with null col causes error - 09-22-2005 , 09:27 AM







The following bug has been logged online:

Bug reference: 1904
Logged by: Brian Cox
Email address: bcox (AT) timestock (DOT) com
PostgreSQL version: 8.0.3
Operating system: Linux (Fedora Core 2)
Description: using distinct with null col causes error
Details:

any_db=> create view view1 as select null as col1 from any_table;
CREATE VIEW
any_db=> select distinct col1 from view1;
ERROR: failed to find conversion function from "unknown" to text

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1904: using distinct with null col causes error - 09-22-2005 , 10:39 AM






"Brian Cox" <bcox (AT) timestock (DOT) com> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.