[prev in list] [next in list] [prev in thread] [next in thread]
List: postgresql-general
Subject: Re: [GENERAL] Importing data w/ Unix timestamp
From: Tom Lane <tgl () sss ! pgh ! pa ! us>
Date: 2000-06-29 19:04:01
[Download RAW message or body]
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> Another side comment: afaik an explicit conversion to abstime is not
> required to go from Unix time to timestamp. So
> insert into RealTable select uname, timestamp(timeinAsInt4),
> duration, etc from TempTable;
> should be equivalent.
Ah, right, that does work. Just to drift a little further off topic,
the locutions
timeinAsInt4::timestamp
cast (timeinAsInt4 as timestamp)
do not work, because in those cases the parser expects to find a
one-step conversion method, and there isn't one --- at least not in
the standard set of Postgres functions. The function-call syntax works
because there is a function timestamp(abstime) and the parser figures
out it can resolve the ambiguous function name timestamp() as that
function if it first applies int4-to-abstime coercion, which it knows
how to do.
In short: you can get a two-step type conversion from the function call
notation, but only one-step from cast notation.
regards, tom lane
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic