Insert NULL for ''

Поиск
Список
Период
Сортировка
От Daniel Gehrke
Тема Insert NULL for ''
Дата
Msg-id 000d01c3319f$9055d090$05011fac@neustac005
обсуждение исходный текст
Ответы Re: Insert NULL for ''  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Insert NULL for ''  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Список pgsql-general
Hello,

I am porting an application from MS SQL 7.0 that dynamically creates
statements.
I have a table with a date field. Now I would like postgresql to insert NULL
when I insert '':

insert into foo (bar) values ('');

So in this case I want postgresql to insert NULL instead of giving the error
message "ERROR:  Bad date external representation '' "

I know, that the error message is correct and that "insert into foo (bar)
values (NULL)" would be the correct way. But unfortunately I cannot change
the application to do so, therefore my question is:
Is there any possibility to get postgresql to insert NULL when I do "insert
into foo (bar) values ('')?

Daniel Gehrke


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

Предыдущее
От: Martin Marques
Дата:
Сообщение: Re: Postgres performance comments from a MySQL user
Следующее
От: Christoph Haller
Дата:
Сообщение: Re: query plan and parenthesis