Re: plpgsql: check domain constraints - Mailing list pgsql-patches

From Tom Lane
Subject Re: plpgsql: check domain constraints
Date
Msg-id 25708.1136782612@sss.pgh.pa.us
Whole thread Raw
In response to plpgsql: check domain constraints  (Neil Conway <neilc@samurai.com>)
Responses Re: plpgsql: check domain constraints
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> (2) adjust pl/pgsql to fetch the constraints associated with the
> function's return value. Because this is expensive, the constraints are
> fetched once per session, when the function is compiled.

We have gone out of our way to make sure that domain constraint checking
responds promptly (ie, within one query) to updates of the domain
definition.  Caching at the session level in plpgsql would be a
significant regression from that, and I don't think it's acceptable.
If you had a way of invalidating the cache when needed, it'd be great
... but not without that.

> I also made a few semi-related cleanups. In pl_exec.c, it seems to me
> that estate.eval_econtext MUST be non-NULL during the guts of both
> plpgsql_exec_trigger() and plpgsql_exec_function(). Therefore checking
> that estate.eval_econtext is non-NULL when cleaning up is unnecessary
> (line 649 and 417 in current sources, respectively), so I've removed the
> checks. Am I missing something?

The code doesn't currently assume that, and it doesn't seem to me that
saving one simple if-test is a reason to add the assumption ...

            regards, tom lane

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: plpgsql: check domain constraints
Next
From: Neil Conway
Date:
Subject: Re: plpgsql: check domain constraints