Re: Why is default value not working on insert?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Why is default value not working on insert?
Дата
Msg-id 20060808205333.GE13311@svana.org
обсуждение исходный текст
Ответ на Why is default value not working on insert?  ("Chris Hoover" <revoohc@gmail.com>)
Список pgsql-general
On Tue, Aug 08, 2006 at 04:41:04PM -0400, Chris Hoover wrote:
> I have the following table:

<snip>

> The reason for the null being passed to to_date is this is on of almot 90k
> lines of data we are trying to load, and the script was built to generate
> this code.  Since to_date(null,'yyyymmdd') returns a null, why is the
> default not working?

If you try to insert a NULL into a not null column, you get an error.
To trigger the default you either need to omit the column from the
insert statement, or use the DEFAULT keyword.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: "Ian Barwick"
Дата:
Сообщение: Re: Why is default value not working on insert?
Следующее
От: Steve Crawford
Дата:
Сообщение: clients and libs and versions (oh my)