David G Johnston
2014-08-27 13:52:59 UTC
In need of some help - The use case is to insert current time in UTC for a
timestamp column
using COPY command . It works fine if i just have now() in csv file input.
But if i add
now() at time zone 'utc' it gives the error as
ERROR: invalid input syntax for type timestamp: "now() at time zone
'utc'"
I need to enforce UTC somehow to current time. Any pointers here pls ?
Your timestamp column target should be with timezone and, if so, whatevertimestamp column
using COPY command . It works fine if i just have now() in csv file input.
But if i add
now() at time zone 'utc' it gives the error as
ERROR: invalid input syntax for type timestamp: "now() at time zone
'utc'"
I need to enforce UTC somehow to current time. Any pointers here pls ?
value 'now' resolves to will be converted to and stored in UTC
automatically.
Though typically you are better advised to simply not import a default
column and instead leave the table default expression to assign a value.
Also, you cannot use functions when importing via copy. The 'now' in this
case is a special keyword interpreted by the timestamp input function and is
not actually a (direct) reference to the now() function provided by
PostgreSQL.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Issue-with-COPY-command-tp5816527p5816553.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general