Re: How can I insert NULL into column with the type of timestamp?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: How can I insert NULL into column with the type of timestamp?
Дата
Msg-id 20071212154445.GE7925@alvh.no-ip.org
обсуждение исходный текст
Ответ на How can I insert NULL into column with the type of timestamp?  ("bookman bookman" <bookmanb@gmail.com>)
Список pgsql-general
bookman bookman escribió:

> Then error occured:
>     error:invalid input syntax for type timestamp:""
>     context:copy T_Admin ,line 2,column regDate:""
> It seemed that the column REGDATE cannot accept a NULL.I tested it use:
>    insert into T_Admin(name,key,regDate,isLock,realName)
>    values('aaa','aaa','','1','aaa');
> The same error occured.
>
>   So it means that the column with type timestamp cannot accept a NULL
> .Is there any way I can tansfer this table into postgre?How can i deal
> with NULL in this case?

No, it doesn't mean that.  It means that you are trying to insert an
empty string.  Try this:

    insert into T_Admin(name,key,regDate,isLock,realName)
    values('aaa','aaa',NULL,'1','aaa');

Similarly, the NULL timestamp column in the file you give to COPY should
not contain empty quotes.

--
Alvaro Herrera                        http://www.advogato.org/person/alvherre
"Crear es tan difícil como ser libre" (Elsa Triolet)

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

Предыдущее
От: SHARMILA JOTHIRAJAH
Дата:
Сообщение: slony1 replication question
Следующее
От: Collin Kidder
Дата:
Сообщение: Re: Would it be OK if I put db file on a ext2 filesystem?