Re: [HACKERS] Misleading Error Message

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Kristofer Munn <kmunn(at)munn(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Misleading Error Message
Date: 1999-05-16 05:25:59
Message-ID: 199905160525.BAA00735@candle.pha.pa.us
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.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-05-16 05:46:48 Re: [HACKERS] How good is FreeBSD for postgres ?
Previous Message Kristofer Munn 1999-05-16 04:10:12 Misleading Error Message