Re: BUG #1871: operations with data types
От | Bruce Momjian |
---|---|
Тема | Re: BUG #1871: operations with data types |
Дата | |
Msg-id | 200509161939.j8GJdcQ22198@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: BUG #1871: operations with data types (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
Added to TODO: o Fix SELECT INTERVAL '1' MONTH; --------------------------------------------------------------------------- Tom Lane wrote: > Michael Fuhr <mike@fuhr.org> writes: > > I just noticed something in PostgreSQL that might be considered > > surprising (although I do see "Add ISO INTERVAL handling" in the > > TODO list): > > > test=> select interval '1' month; > > interval > > ---------- > > 00:00:00 > > (1 row) > > > What's the parser doing here? > > Not getting it right ;-). Trying this in historical versions is > amusing: > > 7.0: > regression=# select interval '1' month; > ERROR: parser: parse error at or near "month" > > 7.1: > regression=# select interval '1' month; > ERROR: Bad interval external representation '1' > > 7.2: > regression=# select interval '1' month; > interval > ---------- > 00:00 > (1 row) > > 7.3: > regression=# select interval '1' month; > interval > ---------- > 00:00:01 > (1 row) > > 7.4 and up: > regression=# select interval '1' month; > interval > ---------- > 00:00:00 > (1 row) > > What is happening in the current versions is that coerce_type thinks > it can coerce the literal string to interval without supplying the > modifier, and then use interval_scale() to apply the typmod. This > works OK for most of the data types, but not for interval it seems... > > Basically the support for these weird syntaxes is something that Tom > Lockhart never finished, and no one has bothered to pick up the work > since he left the project. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-bugs по дате отправления: