Re: [BUGS] BUG #14883: Syntax SQL error (42601), but should be adifferent error no

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [BUGS] BUG #14883: Syntax SQL error (42601), but should be adifferent error no
Дата
Msg-id CAKJS1f-30JFzWsuSmHzRb2KJxQWZ57qxtEEXd4FXMDm4PfMHcQ@mail.gmail.com
обсуждение исходный текст
Ответ на [BUGS] BUG #14883: Syntax SQL error (42601),but should be a different error no  (stefan.hanenberg@googlemail.com)
Ответы Re: [BUGS] BUG #14883: Syntax SQL error (42601), but should be adifferent error no
Список pgsql-bugs
On 31 October 2017 at 13:36,  <stefan.hanenberg@googlemail.com> wrote:
> The following SQL statement leads to an error 42601 (syntax error), although
> the error is not a syntax error.
>
> create table t1 (a integer,b integer);
> create table t2 (a integer,b integer,c integer);
> select * from t1 union select * from t2;
>
> We are currently running automated tests on hundreds of thousands SQL in
> order to check, what kind of errors they contain. It is really problematic
> for us that the error is a 42601 error, although it seems rather as if it is
> a type error.

I guess it depends on how you've written the query. If you'd done:

select a,b from t1 union select a,b,c from t2;

then a syntax error seems a bit more reasonable.

The problem is that the '*' is just expanded to all non-dropped
columns well before getting to where that error is generated.

To fix it we'd likely need to just mark that the RangeTblEntry was
expanded in expandRelAttrs() then generate some other SQLCODE if any
of the RangeTblEntries where expanded.

So it looks simple enough to fix, at first glance.

-- David Rowley                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: stefan.hanenberg@googlemail.com
Дата:
Сообщение: [BUGS] BUG #14883: Syntax SQL error (42601),but should be a different error no
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [BUGS] BUG #14883: Syntax SQL error (42601), but should be adifferent error no