Re: do functions cache views?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: do functions cache views?
Дата
Msg-id 15923.988653587@sss.pgh.pa.us
обсуждение исходный текст
Ответ на do functions cache views?  ("Thomas F. O'Connell" <tfo@monsterlabs.com>)
Список pgsql-general
"Thomas F. O'Connell" <tfo@monsterlabs.com> writes:
> now, this function works for existing records in the table
> significant_records. but as i add records, i end up having to drop and
> recreate the function in order for it to record the existence of the new
> records.

This is hard to believe.

I am not sure that "if not found" means anything after a "select max()"
query.  The select will always return exactly one row --- even if it's
just a NULL --- so I'd expect the "if not found" never to succeed.
Perhaps you want to be testing whether v_significant_date is NULL or
not, instead.

Another issue, since you omitted the details of the view and of what
version you are running, is whether the view involves GROUP BY and/or
aggregates.  An aggregate over a grouped view won't work properly in
versions before 7.1.

If it's not those issues then we'll need more details --- preferably
a self-contained example.

            regards, tom lane

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

Предыдущее
От: "Thomas F. O'Connell"
Дата:
Сообщение: do functions cache views?
Следующее
От: "Dr. Evil"
Дата:
Сообщение: chr() command in PG7.03?