pgsql: Update SQL-standard INTERVAL item: o Support ISO

From: momjian(at)postgresql(dot)org (Bruce Momjian)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Update SQL-standard INTERVAL item: o Support ISO
Date: 2006-04-25 00:01:45
Message-ID: 20060425000145.25C2A11F6ADE@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Update SQL-standard INTERVAL item:

o Support ISO INTERVAL syntax if units cannot be determined from
the string, and are supplied after the string

The SQL standard states that the units after the string specify
the units of the string, e.g. INTERVAL '2' MINUTE should
return '00:02:00'. The current behavior has the units
restrict the interval value to the specified unit or unit range,
INTERVAL '70' SECOND returns '00:00:10'.

For syntax that isn't uniquely ISO or PG syntax, like '1' or
'1:30', treat as ISO if there is a range specification clause,
and as PG if there no clause is present, e.g. interpret
'1:30' MINUTE TO SECOND as '1 minute 30 seconds', and
interpret '1:30' as '1 hour, 30 minutes'.

This makes common cases like SELECT INTERVAL '1' MONTH
SQL-standard results. The SQL standard supports a limited
number of unit combinations and doesn't support unit names
in the string. The PostgreSQL syntax is more flexible in
the range of units supported, e.g. PostgreSQL supports
'1 year 1 hour', while the SQL standard does not.

Modified Files:
--------------
pgsql/doc:
TODO (r1.1807 -> r1.1808)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/TODO.diff?r1=1.1807&r2=1.1808)
pgsql/doc/src/FAQ:
TODO.html (r1.310 -> r1.311)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/FAQ/TODO.html.diff?r1=1.310&r2=1.311)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2006-04-25 00:06:23 pgsql: Word wrap entry
Previous Message Bruce Momjian 2006-04-24 22:59:46 pgsql: Done; o -Add support for day-time syntax, INTERVAL '1