Re: migrating from mysql: need to convert empty string to null

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: migrating from mysql: need to convert empty string to null
Дата
Msg-id 10655.1213839017@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: migrating from mysql: need to convert empty string to null  ("Dave Lee" <davelee.com@gmail.com>)
Список pgsql-general
"Dave Lee" <davelee.com@gmail.com> writes:
> I've read src/backend/utils/fmgr/README and it states that returning
> NULL is just a matter of setting isnull to true in the
> FunctionCallInfo struct, and provides a convenience macro,
> PG_RETURN_NULL. But then, in InputFunctionCall, I presume you're
> referring to the logic that that only allows NULL to be returned if
> the source input string is also NULL, otherwise raising an error. At a
> basic level, you're suggesting I need to take out this NULL check in
> InputFunctionCall to get the capability I'm looking for?

No, I'm stating it as a fact that that won't work.  You'd have to
change InputFunctionCall's API so that it could pass back a null to
its callers.

> Any idea why the input functions were designed this way?

Per above, and the fact that the behavior you're proposing is a
complete violation of the SQL spec (yeah, I know Oracle does it too).

            regards, tom lane

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Understanding fsync
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Forcibly vacating locks