Re: overloaded functions and NULL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: overloaded functions and NULL
Дата
Msg-id 10280.1097642659@sss.pgh.pa.us
обсуждение исходный текст
Ответ на overloaded functions and NULL  (Kris Jurka <books@ejurka.com>)
Ответы Re: overloaded functions and NULL  (Gaetano Mendola <mendola@bigfoot.com>)
Список pgsql-bugs
Kris Jurka <books@ejurka.com> writes:
> The below code creates overloaded
> functions that do not produce this error when called with a NULL argument.

> jurka=# CREATE FUNCTION g(int) RETURNS int AS 'SELECT 1;' LANGUAGE sql;
> CREATE FUNCTION
> jurka=# CREATE FUNCTION g(float) RETURNS int AS 'SELECT 2;' LANGUAGE sql;
> CREATE FUNCTION

float (a/k/a float8) is the preferred type in the numeric hierarchy,
so it will win in a tug-of-war against int.  There are other cases
where it would lose (eg, had you declared g(text)).  The objective
of the type rules is most certainly not to fail in any ambiguous
situation --- if we did, we'd have a completely unusable system.

            regards, tom lane

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: overloaded functions and NULL
Следующее
От: "PostgreSQL Bugs List"
Дата:
Сообщение: BUG #1285: Violacion de segmento