pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedtimestamp precision - can I control precision at select time or set for all time?
3+ messages / 2 participants
[nested] [flat]
* timestamp precision - can I control precision at select time or set for all time?
@ 2005-03-16 22:57 mroyce@gmail.com <mroyce@gmail.com>
2005-03-22 08:50 ` Re: timestamp precision - can I control precision at select time Christoph Haller <ch@rodos.fzk.de>
0 siblings, 1 reply; 3+ messages in thread
From: mroyce@gmail.com @ 2005-03-16 22:57 UTC (permalink / raw)
To: pgsql-sql
I have a database with several tables that use timestamp without time
zone type. I upgraded from an older pgsql and have code that does not
expect the precision in the select output. Is there a way I can get the
effect of zero precision without modifying all the tables?
The docs say it usees "default precision" as set in the "timestamp
literal". I wasn't able to find docs describing what literals are. If
there's a way I can set this to zero precision for everything, that'd
save me a bunch of time.
with thanks,
Royce
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: timestamp precision - can I control precision at select time
2005-03-16 22:57 timestamp precision - can I control precision at select time or set for all time? mroyce@gmail.com <mroyce@gmail.com>
@ 2005-03-22 08:50 ` Christoph Haller <ch@rodos.fzk.de>
2005-03-24 03:47 ` Re: timestamp precision - can I control precision at select time mroyce@gmail.com <mroyce@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Haller @ 2005-03-22 08:50 UTC (permalink / raw)
To: mroyce@gmail.com <mroyce@gmail.com>; +Cc: pgsql-sql
"mroyce@gmail.com" wrote:
>
> I have a database with several tables that use timestamp without time
> zone type. I upgraded from an older pgsql and have code that does not
> expect the precision in the select output. Is there a way I can get the
> effect of zero precision without modifying all the tables?
>
> The docs say it uses "default precision" as set in the "timestamp
> literal". I wasn't able to find docs describing what literals are. If
> there's a way I can set this to zero precision for everything, that'd
> save me a bunch of time.
>
> with thanks,
> Royce
>
I was facing the same obstacle.
The only cure I've found was either
SELECT CURRENT_TIMESTAMP ;
timestamptz
------------------------------
2005-03-22 09:43:51.05193+01
(1 row)
SELECT CURRENT_TIMESTAMP::TIMESTAMP(0) ;
timestamp
---------------------
2005-03-22 09:44:11
(1 row)
resp. change column types to TIMESTAMP(0)
But I assume you've found this already by yourself.
Regards, Christoph
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: timestamp precision - can I control precision at select time
2005-03-16 22:57 timestamp precision - can I control precision at select time or set for all time? mroyce@gmail.com <mroyce@gmail.com>
2005-03-22 08:50 ` Re: timestamp precision - can I control precision at select time Christoph Haller <ch@rodos.fzk.de>
@ 2005-03-24 03:47 ` mroyce@gmail.com <mroyce@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: mroyce@gmail.com @ 2005-03-24 03:47 UTC (permalink / raw)
To: pgsql-sql
thanks, christoph. i did go ahead and retool all the tables, but glad
to know about the casting option.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-03-24 03:47 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-16 22:57 timestamp precision - can I control precision at select time or set for all time? mroyce@gmail.com <mroyce@gmail.com>
2005-03-22 08:50 ` Re: timestamp precision - can I control precision at select time Christoph Haller <ch@rodos.fzk.de>
2005-03-24 03:47 ` Re: timestamp precision - can I control precision at select time mroyce@gmail.com <mroyce@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox