Re: do functions cache views? - Mailing list pgsql-general

From Tom Lane
Subject Re: do functions cache views?
Date
Msg-id 15923.988653587@sss.pgh.pa.us
Whole thread Raw
In response to do functions cache views?  ("Thomas F. O'Connell" <tfo@monsterlabs.com>)
List 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 by date:

Previous
From: "Thomas F. O'Connell"
Date:
Subject: do functions cache views?
Next
From: "Dr. Evil"
Date:
Subject: chr() command in PG7.03?