On Thursday, June 23, 2011 1:42:42 pm hernan gonzalez wrote:

> Fair enough: to_timestamp doesn't do what I want, I must resort to casting.
> 
> But it's rather unfortunate that a to_timestamp() function doesnt actually
> parse a "timestamp" (which, is a alias  to "timestamp without timezone", at
> least since PG 7.3) .

To split hairs to_timestamp() parses a string and returns a timestamp with time 
zone. What you want is a function that parses a string and does not 
editorialize 
the result.  FYI the code that handles this is located in the source at:
src/backend/utils/adt
as 
formatting.c

> 
> BTW, the "set datestyle" workaround can be umpractical in some scenarios
> (case in point: I have a view that returns some column as "timestamp" by
> doing that parsing from a text colum ) I even can't put a "SET DATESTYLE"
> (or a SET TIMEZONE=UTC)" in a function, unless I make it VOLATILE, which I
> certainly would not like.

Might want to look at one of the non-pgsql languages that have their own 
timezone/date handling code. Basically do an end run around Postgres.

> 
> Regards
> 
> Hernán J. González

-- 
Adrian Klaver
adrian.kla...@gmail.com

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

Reply via email to