Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux