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

Поиск
Список
Период
Сортировка
От Dave Lee
Тема Re: migrating from mysql: need to convert empty string to null
Дата
Msg-id cb13bf640806181310i25849b88xd4d967402848aa4b@mail.gmail.com
обсуждение исходный текст
Ответ на Re: migrating from mysql: need to convert empty string to null  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: migrating from mysql: need to convert empty string to null  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Wed, Jun 18, 2008 at 12:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> None.  There is no type coercion there --- what that is really
> specifying is invocation of the int data type's input function
> on the given string.

I thought that something like this may be this was the case.

> I don't think your approach is going to work; you would have to
> make your client programs emit things like
>
>        insert into mytab(integercol) values (''::varchar)
>
> in order to get a runtime varchar-to-int cast to be applied.
> At that point you might as well fix them properly.

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?

thanks for your explanation Tom,

Dave

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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Easiest way to copy table from one db to another?
Следующее
От: Steve Clark
Дата:
Сообщение: renumber table