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 7706.1213824337@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: migrating from mysql: need to convert empty string to null  ("Dave Lee" <davelee.com@gmail.com>)
Ответы 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 see. Other than directly modifying int4in (is this the one?), is
> there a way to plug-in our modified empty string handling logic? I'm
> picturing a scenario where we write write a wrapper function that
> tests for empty strings and returns NULL, else just calls into int4in,
> and then dynamically load this function, and finally update the
> corresponding rows in pg_proc? Is this even possible?

There isn't any really nice way to do that :-(.  You could put a wrapper
function around int4in but it would not help, because the internal API
for datatype input functions doesn't support having them return NULL
(see InputFunctionCall in the sources).  If you don't want to fix your
clients then you'll really have little choice but to hack the Postgres
source code.  The good news is there are probably not very places you'd
have to change, depending on exactly what contexts you need this to
happen in.

            regards, tom lane

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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: renumber table
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Database design: Temporal databases