Skip site navigation (1) Skip section navigation (2)

NAB : insert into <table> select distinct <fields> => when used on null, distinct causes loss of type knowledge

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: NAB : insert into <table> select distinct <fields> => when used on null, distinct causes loss of type knowledge
Date: 2004-08-24 21:16:37
Message-ID: 200408242316.38155.ftm.van.vugt@foxi.nl (view raw or flat)
Thread:
Lists: pgsql-general
Hi,


Not exactly a showstopper, but I noticed this behaviour:

db=# create table f1 (id int, value int);
CREATE TABLE

db=# insert into f1 select 1 as id, null;
INSERT 25456306 1

db=# insert into f1 select distinct 2 as id, null;
ERROR:  column "value" is of type integer but expression is of type text
HINT:  You will need to rewrite or cast the expression.

db=# insert into f1 select distinct on (id) 2 as id, null;
INSERT 25456307 1

So it seems distinct applied to the second column causes it to lose knowledge 
on its type. 

Does anybody happen to know why ?




-- 
Best,




Frank.


Responses

pgsql-general by date

Next:From: Stephan SzaboDate: 2004-08-24 21:26:57
Subject: Re: How is this possible? (more on deadlocks)
Previous:From: Doug McNaughtDate: 2004-08-24 21:15:23
Subject: Re: Problem to connect to the Windows Port

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group