Skip site navigation (1) Skip section navigation (2)

plpgsql: check domain constraints

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: plpgsql: check domain constraints
Date: 2006-01-09 04:30:40
Message-ID: 1136781040.8718.24.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Attached is a patch that makes the following changes:

(1) refactor execQual.c to expose a function for checking an instance of
a domain value against a list of domain constraints

(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. I then modified
pl/pgsql to check any applicable constraints on the return value of a
function before returning it to the backend.

(3) add some regression tests for #2

The patch does NOT add checking of domain constraints for other PLs, or
for intermediate values in PL/PgSQL -- I plan to take a look at doing
one or both of those soon.

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?

Barring any objections I'll apply this patch tomorrow some time.

-Neil


Attachment: plpgsql_domain_constr-2.patch
Description: text/x-patch (10.5 KB)

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-01-09 04:56:52
Subject: Re: plpgsql: check domain constraints
Previous:From: Waso Training CenterDate: 2006-01-09 04:04:18
Subject: พนักงานธุรการยุคใหม่ Modern Office Management System

pgsql-patches by date

Next:From: Tom LaneDate: 2006-01-09 04:56:52
Subject: Re: plpgsql: check domain constraints
Previous:From: Qingqing ZhouDate: 2006-01-09 01:13:25
Subject: Re: Change BgWriterCommLock to spinlock

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group