Re: BUG #1517: SQL interval syntax is accepted by the parser,

Поиск
Список
Период
Сортировка
От Ron Mayer
Тема Re: BUG #1517: SQL interval syntax is accepted by the parser,
Дата
Msg-id 42420399.9070405@cheapcomplexdevices.com
обсуждение исходный текст
Ответ на Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-bugs
Bruce Momjian wrote:
> This is going to be a backward compatibility problem

You say that as if it's a bad thing.

In a previous thread, I think Bruce and Tom both commented on
ripping out some of the weird undocumented interval behavior:

   http://archives.postgresql.org/pgsql-patches/2003-09/msg00134.php
   http://archives.postgresql.org/pgsql-patches/2003-09/msg00123.php

There be a lot of dragons in the PostgreSQL interval syntax.

Some examples from that old thread:
   Why is
      '0.001 years'::interval
   less than
      '0.001 months'::interval
or
   While does PostgreSQL think the interval
      '1Y1M'::interval'
   means "1 year and one minute, which is confusing
   because the very similar ISO 8601 time interval
      'P1Y1M'
   means "1 year and one month" to the ISO-8601 spec?

At some point I think breaking backward computability for
some of the weird undocumented behavior of PostgreSQL's
interval syntax would be a good thing.  Or perhaps a GUC
variable for IntervalStyle kinda like how DateStyle lets
you pick ISO or SQL or Postgres styles - but that's ugly
in different ways....

    Ron

Personally I avoid these problems by still using this hack (a
rejected patch
  http://archives.postgresql.org/pgsql-patches/2003-12/msg00196.php
) that allows ISO 8601 "Time Intervals With Time Unit Designators"
in either ISO-8601's "basic format" or "extended format".  If anyone's
wants the patch for ISO-8601 ( ftp://ftp.qsl.net/pub/g1smd/154N362_.PDF)
intervals, let me know and I can send a version ported to 8.X.

In my mind ISO-8601 intervals actually make sense while the PostgreSQL
intervals and the ISO-SQL intervals are confusing as heck.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Ingolf Knopf"
Дата:
Сообщение: BUG #1561: wrong detection of number of parameters in java.sql.PreparedStatement
Следующее
От: Joel Krajden
Дата:
Сообщение: foreign key constraint not working when index tablespace is not default.