Re: abstract: fix poor constant folding in 7.0.x, fixed in 7.1?
От | Tom Lane |
---|---|
Тема | Re: abstract: fix poor constant folding in 7.0.x, fixed in 7.1? |
Дата | |
Msg-id | 28706.976235095@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | abstract: fix poor constant folding in 7.0.x, fixed in 7.1? (Alfred Perlstein <bright@wintelcom.net>) |
Ответы |
Re: abstract: fix poor constant folding in 7.0.x, fixed in 7.1?
|
Список | pgsql-hackers |
Alfred Perlstein <bright@wintelcom.net> writes: > Each function should have a marker that explains whether when given > a const input if the output might vary, that way subexpressions can > be collapsed until an input becomes non-const. We already have that and do that. The reason the datetime-related routines are generally not marked 'proiscachable' is that there's this weird notion of a CURRENT time value, which means that the result of a datetime calculation may vary depending on when you do it, even though the inputs don't. Note that CURRENT here does not mean translating 'now' to current time during input conversion, it's a special-case data value inside the system. I proposed awhile back (see pghackers thread "Constant propagation and similar issues" from mid-September) that we should eliminate the CURRENT concept, so that datetime calculations can be constant-folded safely. That, um, didn't meet with universal approval... but I still think it would be a good idea. In the meantime you can cheat by defining functions that you choose to mark ISCACHABLE, as has been discussed several times in the archives. regards, tom lane
В списке pgsql-hackers по дате отправления: