Re: 7.2.1: pg_dump of UNIONed VIEWs broken

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 7.2.1: pg_dump of UNIONed VIEWs broken
Дата
Msg-id 14926.1019487365@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 7.2.1: pg_dump of UNIONed VIEWs broken  (Ian Morgan <imorgan@webcon.net>)
Ответы Re: 7.2.1: pg_dump of UNIONed VIEWs broken  (Ian Morgan <imorgan@webcon.net>)
Список pgsql-bugs
Ian Morgan <imorgan@webcon.net> writes:
> The SQL for CREATE VIEW as output by pg_dump generates an error, because the
> appropriate nesting of SELECTs with parentheses is missing:

Hmm.  You shouldn't *need* parentheses in most cases ...

> CREATE VIEW "agents" as (
>         (
>         SELECT DISTINCT
>                 employees.contact_id
>         FROM
>                 employees
>         ORDER BY
>                 employees.contact_id
>         )
> UNION
>         (
>         SELECT DISTINCT
>                 contractors.contact_id
>         FROM
>                 contractors
>         ORDER BY
>                 contractors.contact_id
>         )
> );

although I suppose this is a counterexample.  Would it help any to point
out that ORDER BY inside an arm of a UNION is a complete waste of
cycles?  That's probably why it didn't occur to anyone to test this.

BTW, the SELECT DISTINCTs are also a waste of cycles, since UNION will
do that anyway.

            regards, tom lane

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Bug #638: Buggy select statment with numeric
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug #638: Buggy select statment with numeric