Re: [HACKERS] Oddity with extract microseconds?

2005-12-07 Thread Andrew Dunstan
Christopher Kings-Lynne wrote: Why aren't 'minutes' considered too? Because they aren't 'seconds'. Well, seconds aren't microseconds either. Yeah, they are: it's just one field. The other way of looking at it (that everything is seconds) is served by "extract(epoch)". Well, it's differ

Re: [HACKERS] Oddity with extract microseconds?

2005-12-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: mysql> SELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:01.00123'); >> +---+ >> | EXTRACT(MICROSECOND FROM '2003-01-02 10:30:01.00123') | >> +---

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Christopher Kings-Lynne
mysql> SELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:01.00123'); +---+ | EXTRACT(MICROSECOND FROM '2003-01-02 10:30:01.00123') | +---+ | 1230

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Michael Fuhr
On Wed, Dec 07, 2005 at 10:47:45AM +0800, Christopher Kings-Lynne wrote: > Ok, and what does this give: > > SELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:01.00123'); mysql> SELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:01.00123'); +---+

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Michael Fuhr
On Wed, Dec 07, 2005 at 10:32:20AM +0800, Christopher Kings-Lynne wrote: > >MySQL 5.0.16 gives an error: > > > >mysql> SELECT EXTRACT (MICROSECOND FROM '2003-01-02 10:30:00.00123'); > >ERROR 1064 (42000): You have an error in your SQL syntax; check the manual > >that corresponds to your MySQL serve

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Christopher Kings-Lynne
Looks like MySQL doesn't allow a space before the open parenthesis (there isn't one in the manual's example): mysql> SELECT EXTRACT(MICROSECOND FROM '2003-01-02 10:30:00.00123'); +---+ | EXTRACT(MICROSECOND FROM '2003-01-02 10:30:00.00123') | +-

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Christopher Kings-Lynne
MySQL 5.0.16 gives an error: mysql> SELECT EXTRACT (MICROSECOND FROM '2003-01-02 10:30:00.00123'); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM '2003-01-02 10:30:00.00123')' at line

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Michael Fuhr
On Wed, Dec 07, 2005 at 09:43:30AM +0800, Christopher Kings-Lynne wrote: > >>Why aren't 'minutes' considered too? Because they aren't 'seconds'. > >>Well, seconds aren't microseconds either. > > > >Yeah, they are: it's just one field. The other way of looking at it > >(that everything is seconds

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Christopher Kings-Lynne
Why aren't 'minutes' considered too? Because they aren't 'seconds'. Well, seconds aren't microseconds either. Yeah, they are: it's just one field. The other way of looking at it (that everything is seconds) is served by "extract(epoch)". Well, it's different in MySQL unfortunately - what doe

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Tom Lane
Bruce Momjian writes: > Why aren't 'minutes' considered too? Because they aren't 'seconds'. > Well, seconds aren't microseconds either. Yeah, they are: it's just one field. The other way of looking at it (that everything is seconds) is served by "extract(epoch)". regar

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Bruce Momjian
Tom Lane wrote: > Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > > OK, AndrewSN just pointed out that it's "documented" to work like that... > > ...still seems bizarre... > > It seems reasonably consistent to me. extract() doesn't consider > seconds and fractional seconds to be distinct fi

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Tom Lane
Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > OK, AndrewSN just pointed out that it's "documented" to work like that... > ...still seems bizarre... It seems reasonably consistent to me. extract() doesn't consider seconds and fractional seconds to be distinct fields: it's all one value. T

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Alvaro Herrera
Christopher Kings-Lynne wrote: > OK, AndrewSN just pointed out that it's "documented" to work like that... > > ...still seems bizarre... So it's a "gotcha"! -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x

Re: [HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Christopher Kings-Lynne
OK, AndrewSN just pointed out that it's "documented" to work like that... ...still seems bizarre... Chris Christopher Kings-Lynne wrote: Does anyone else find this odd: mysql=# select extract(microseconds from timestamp '2005-01-01 00:00:00.123'); date_part --- 123000 (1 row) my

[HACKERS] Oddity with extract microseconds?

2005-12-06 Thread Christopher Kings-Lynne
Does anyone else find this odd: mysql=# select extract(microseconds from timestamp '2005-01-01 00:00:00.123'); date_part --- 123000 (1 row) mysql=# select extract(microseconds from timestamp '2005-01-01 00:00:01.123'); date_part --- 1123000 (1 row) No other extracts inc