CURRENT_DATE and CURRENT_TIME are broken
От | Tom Lane |
---|---|
Тема | CURRENT_DATE and CURRENT_TIME are broken |
Дата | |
Msg-id | 28692.982950660@sss.pgh.pa.us обсуждение исходный текст |
Ответы |
Re: CURRENT_DATE and CURRENT_TIME are broken
|
Список | pgsql-hackers |
... in the sense that they are reduced to constants instantly, rather than being preserved as function calls. For example: regression=# create table foo (f1 time default current_time); CREATE regression=# insert into foo default values; INSERT 618879 1 << wait a few seconds >> regression=# insert into foo default values; INSERT 618880 1 regression=# select * from foo; f1 ----------12:41:4512:41:45 (2 rows) The problem appears to be that Thomas inserted new pg_proc entries on 11-Nov-2000 that create direct text-to-date and text-to-time conversions, replacing the old indirect text-to-timestamp-to-date/time implementation of CURRENT_DATE/TIME. Unfortunately, whereas text-to-timestamp is marked noncachable, these new entries are not, and so the parser decides it can fold date('now'::text) to a constant. We have three choices: 1. Change these pg_proc entries. This does not force an initdb, exactly, but it won't take effect without one either. 2. Change the function calls emitted by the parser for CURRENT_DATE/TIME. This doesn't force an initdb either, but it's a workaround whereas #1 actually fixes the real bug. (Although #2 might appear to break stored rules in beta databases, any such rules are already broken because they've already been reduced to constants...) 3. Ship 7.1 with broken CURRENT_DATE/TIME functionality. I tend to favor #1, but need agreement to change it. Comments? If we do #1, should we bump catversion.h, or leave it alone? (I'd vote for not changing catversion, I think.) regards, tom lane
В списке pgsql-hackers по дате отправления: