From: | jwieck(at)debis(dot)com (Jan Wieck) |
---|---|
To: | maillist(at)candle(dot)pha(dot)pa(dot)us (Bruce Momjian) |
Cc: | kmunn(at)munn(dot)com, pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] Misleading Error Message |
Date: | 1999-05-17 08:27:26 |
Message-ID: | m10jIkC-000EBPC@orion.SAPserv.Hamburg.dsh.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
> > Hi all. Was working tonight and ran into the following error. Doing a
> > union between two selects (to get around the lack of outer joins - hint
> > hint), I was getting the error:
> >
> > ERROR: Each UNION clause must have the same number of columns
> >
> > Upon examining the SQL statement in question, I verified that it did,
> > indeed, have the same number of columns. After some fiddling, I found the
> > actual problem was that I was doing an ORDER BY on a column which was not
> > being included in the two select statements. Unfortunately, the error
> > message wasn't pointing at that.
> >
> > I'm not sure if this is just a simple change or implies other problems
> > with the parser but I thought I'd toss it out onto the pile.
>
> Tom Lane discovered it a few days ago in relation to INSERT INTO table
> SELECT * FROM TABLE ORDER BY col1, and col1 was not in the select target
> list. It shows an error. We are looking at solutions.
This might also interfere with latest changes I did in the
rewrite system. Parser and rewriter now add junk attributes
to the targetlist. I think the problem is that the union
code (where the check is done) doesn't recognize that the
unequal length of the targetlists is due to junk attributes.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 1999-05-17 08:51:42 | Re: [HACKERS] select + order by |
Previous Message | Jan Wieck | 1999-05-17 08:18:24 | Re: [HACKERS] rules regression test |