[HACKERS] timestamp format bug

2008-01-31 Thread Roberts, Jon
select to_char(date, '-mm-dd hh24:mi:ss.ms') as char, date from (select timestamp'2008-01-30 15:06:21.560' as date) sub 2008-01-30 15:06:21.560;2008-01-30 15:06:21.56 Why does the timestamp field truncate the 0 but when I show the timestamp as a character in the default timestamp

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Kevin Grittner
On Thu, Jan 31, 2008 at 9:34 AM, in message [EMAIL PROTECTED], Roberts, Jon [EMAIL PROTECTED] wrote: select to_char(date, '-mm-dd hh24:mi:ss.ms') as char, date from (select timestamp'2008-01-30 15:06:21.560' as date) sub 2008-01-30 15:06:21.560;2008-01-30 15:06:21.56

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Tom Lane
Kevin Grittner [EMAIL PROTECTED] writes: On Thu, Jan 31, 2008 at 9:34 AM, in message [EMAIL PROTECTED], Roberts, Jon [EMAIL PROTECTED] wrote: These two fields should be consistent because they should be formatted the same way. Why would you think that? Indeed the whole *point* of

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Roberts, Jon
-Original Message- From: Kevin Grittner [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 9:48 AM To: Roberts, Jon; pgsql-hackers@postgresql.org Subject: Re: [HACKERS] timestamp format bug On Thu, Jan 31, 2008 at 9:34 AM, in message [EMAIL PROTECTED], Roberts, Jon

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Kevin Grittner
On Thu, Jan 31, 2008 at 12:34 PM, in message [EMAIL PROTECTED], Roberts, Jon [EMAIL PROTECTED] wrote: If not to_char, what is the preferred method to convert a timestamp to a string? Your original post showed to_char apparently doing what you wanted, no? select to_char(date, '-mm-dd

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Kevin Grittner
On Thu, Jan 31, 2008 at 12:28 PM, in message [EMAIL PROTECTED], Roberts, Jon [EMAIL PROTECTED] wrote: The default timestamp format appears to be -mm-dd hh24:mi:ss.ms Not to me: select now(); now --- 2008-01-31 12:31:40.568746-06 (1 row)

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Roberts, Jon
-Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 10:48 AM To: Kevin Grittner Cc: Roberts, Jon; pgsql-hackers@postgresql.org Subject: Re: [HACKERS] timestamp format bug Kevin Grittner [EMAIL PROTECTED] writes: On Thu, Jan 31, 2008

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Roberts, Jon
-Original Message- From: Kevin Grittner [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 12:33 PM To: Roberts, Jon; pgsql-hackers@postgresql.org Subject: RE: [HACKERS] timestamp format bug On Thu, Jan 31, 2008 at 12:28 PM, in message [EMAIL PROTECTED], Roberts, Jon

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Kevin Grittner
On Thu, Jan 31, 2008 at 12:45 PM, in message [EMAIL PROTECTED], Roberts, Jon [EMAIL PROTECTED] wrote: So on your db, run this query: select sub.t1, to_char(t1, '-mm-dd hh24:mi:ss.us') as char_t1 from ( select timestamp'2008-01-31 12:31:40.50' as t1 ) sub I bet you get this:

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Kevin Grittner
On Thu, Jan 31, 2008 at 12:34 PM, in message [EMAIL PROTECTED], Roberts, Jon [EMAIL PROTECTED] wrote: doesn't round the zeros off for timestamp Sorry to have been so slow, but I think this is the crux of it: A timestamp represents a moment in time, without storing any precision

Re: [HACKERS] timestamp format bug

2008-01-31 Thread Roberts, Jon
-Original Message- From: Kevin Grittner [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 1:47 PM To: Roberts, Jon; pgsql-hackers@postgresql.org Subject: RE: [HACKERS] timestamp format bug On Thu, Jan 31, 2008 at 12:45 PM, in message [EMAIL PROTECTED], Roberts, Jon