Re: BUG #11266: failed to find conversion function from unknown to bigint

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #11266: failed to find conversion function from unknown to bigint
Дата
Msg-id 10896.1409064152@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #11266: failed to find conversion function from unknown to bigint  (zoulx1982@163.com)
Список pgsql-bugs
zoulx1982@163.com writes:
> select s.*
> from
> (select a, null b from t1
> group by a
> ) s
> union all
> select x,y from t2;--ERROR

> is there parameters to avoid the issue without changing original sql,
> or doe's somebody can fix the issue later ?

No, and no.  You need to cast the NULL literal to some specific datatype
(in this example, you want the type of t2.y).

A bare NULL like this is illegal per SQL standard; you're always supposed
to cast it, or else write it in a place like an INSERT list where the
null's type can be inferred from immediate context.  Most real DBMSes
allow you to violate that rule to some extent, but you should not be
surprised that the exact places where you can get away with it vary from
product to product.  Postgres is not exactly like Oracle in this respect,
and we're unlikely to try to make it so.

            regards, tom lane

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

Предыдущее
От: zoulx1982@163.com
Дата:
Сообщение: BUG #11266: failed to find conversion function from unknown to bigint
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: BUG #11208: Refresh Materialized View Concurrently bug using user Postgres