Search Postgresql Archives

Re: copy from with trigger

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

 



Chris spotts <rfusca@xxxxxxxxx> writes:
> I'm trying to copy from a tab delimited file.  The dates inside the file
> are Unix timestamp style dates.
> I thought the following script would do the trick, but it just gives me
> an error saying 
> ERROR:  invalid input syntax for type timestamp: "1238736600"
> CONTEXT:  COPY testtable line 1, column acquire_time: "1238736600"

A trigger isn't going to help in the least for that; the data has to be
a valid timestamp before the trigger will ever see it.

The usual trick for this type of conversion is to load the data into a
temporary table that has simple column types (eg integer or text) and
then do your transformations during an INSERT/SELECT into the real
target table.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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