Re: [HACKERS] Error in parser with UNIONS.

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] Error in parser with UNIONS.
Дата
Msg-id 199805220338.XAA18447@candle.pha.pa.us
обсуждение исходный текст
Ответ на Error in parser with UNIONS.  (Chris Albertson <chris@topdog.pas1.logicon.com>)
Список pgsql-hackers
>
> Got no reply on "questions".  Someone here may want to
> know this...
>
> I think I may have uncovered an error in the parser.  The
> following is the simplest example that shows the problem.
> Maybe a counter needs to be reset by 'union' or checked
> after select not statement.  I would like to use this syntax
> in my libpq program.  Is this a bug?  Is it already known?
>
> Would someone please e-mail me the syntax for the
> "explicit cast" the system wants
>
> I am using 6.3.2 on an Ultra SPARC.  The error occurs on
> a Linux RH50 Intel system too.
>
> I think the following should work but does not:
>
>    testdb=> select 'a' as X
>    testdb-> union
>    testdb-> select 'b' as X;
>    NOTICE:  there is more than one operator < for types
>    NOTICE:  unknown and unknown. You will have to retype this query
>    ERROR:  using an explicit cast
>
> Notice that this does work
>
>    testdb=>  select 'b' as X;
>    x
>    -
>    b
>    (1 row)
>
> And this works too:
>
>    testdb=> select 1 as X
>    testdb-> union
>    testdb-> select 2 as X;
>    x
>    -
>    1
>    2
>    (2 rows)
>

This caused because UNION removes duplicates, and to do that, it must
sort, but the character constants can't be sorted because they could be
text, varchar, char(), etc.  6.4 will fix that with new auto-casting.
For now, us UNION ALL, which will not remove duplicates.


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

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

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Error in parser with UNIONS.
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Bug in postgresql-6.3.2