Odd 'except' and 'default' interaction behavior - Mailing list pgsql-bugs

From phil@netroedge.com
Subject Odd 'except' and 'default' interaction behavior
Date
Msg-id 20010323161134.Q10211@Stimpy.netroedge.com
Whole thread Raw
Responses Re: Odd 'except' and 'default' interaction behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
We noticed a strange behavior involving 'except' and 'default'
interaction.  Example from psql:

wpbb=# \d robtest
          Table "robtest"
 Attribute |  Type   |  Modifier
-----------+---------+-------------
 id        | integer | default '1'
 userid    | integer |
 articleid | integer |

wpbb=# insert into robtest (userid,articleid) select '1'::int4,'2'::int4 except select '2'::int4,'5'::int4;
ERROR:  Each UNION | EXCEPT | INTERSECT query must have the same number of columns.

wpbb=# alter table robtest alter column id drop default;
ALTER

wpbb=# insert into robtest (userid,articleid) select '1'::int4,'2'::int4 except select '2'::int4,'5'::int4;
INSERT 306530 1


Notice that error regarding the usage of except and the # of columns.
Strange.  Yet, that exact same query works fine when we remove a
default on a column on the table which isn't being referenced.

I'm not sure if this is a bug, a poorly written error message, or my
ignorance. :')  We are using Postgresql 7.0.3 release under Linux:

phil=# select version();
                            version
----------------------------------------------------------------
 PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.7.2.3 (1 row)


Thanks!!


Phil

--
Philip Edelbrock -- IS Manager -- Edge Design, Corvallis, OR
   phil@netroedge.com -- http://www.netroedge.com/~phil
 PGP F16: 01 D2 FD 01 B5 46 F4 F0  3A 8B 9D 7E 14 7F FB 7A

pgsql-bugs by date:

Previous
From: "Henshall, Stuart - WCP"
Date:
Subject: 7.1b6 Compile fail on cygwin with --enable-cassert
Next
From: Tom Lane
Date:
Subject: Re: Odd 'except' and 'default' interaction behavior