Re: do functions cache views?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Thomas F(dot) O'Connell" <tfo(at)monsterlabs(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: do functions cache views?
Date: 2001-04-30 17:59:47
Message-ID: 15923.988653587@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Thomas F. O'Connell" <tfo(at)monsterlabs(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dr. Evil 2001-04-30 18:31:35 chr() command in PG7.03?
Previous Message Dan Wilson 2001-04-30 16:45:03 Dynamic Queries in pl/pgsql [w/variable substitution]