Skip to site navigation (Press enter)

[GENERAL] NAB : insert into select distinct => when used on null, distinct causes loss of type knowledge

Frank van Vugt Tue, 24 Aug 2004 14:19:27 -0700

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.


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
  • Previous message
  • View by thread
  • View by date
  • Next message
  • Re: [GENERAL] NAB : insert into <table> select distin... Frank van Vugt
    • Re: [GENERAL] NAB : insert into <table> select d... Tom Lane
      • Re: [GENERAL] NAB : insert into <table> sele... Frank van Vugt

Reply via email to

The Mail Archive
  • The Mail Archive home
  • pgsql-general - all messages
  • pgsql-general - about the list
  • Expand
  • Previous message
  • Next message
  • The Mail Archive home
  • Add your mailing list
  • FAQ
  • Support
  • Privacy
  • 200408242316.38155.ftm.van.vugt@foxi.nl