Re: Bug#347548: DOMAIN CHECK constraint bypassed - Mailing list pgsql-bugs

From Neil Conway
Subject Re: Bug#347548: DOMAIN CHECK constraint bypassed
Date
Msg-id 1138675817.8835.29.camel@localhost.localdomain
Whole thread Raw
In response to Re: Bug#347548: DOMAIN CHECK constraint bypassed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, 2006-01-30 at 20:45 -0500, Tom Lane wrote:
> You only fixed the bind-parameter case, though, no?  The problem is
> still rampant in the PLs.

Right: the bug report was specific to the bind parameter case. Domain
constraints should also be checked before returning values of a domain
type from all of the procedural languages, and before casting a value to
a domain type in PL/PgSQL.

This can be done by adding constraint checks to each PL individually,
like this patch for PL/PgSQL's return value:

http://archives.postgresql.org/pgsql-patches/2006-01/msg00107.php

(The patch hasn't been applied because there is some additional
infrastructure needed to get good performance.)

We could do similar work for each PL. That actually wouldn't be too bad:
adding the necessary domain constraint information (plus sinval support)
to the typcache would allow most of the code to be shared. Or we could
refactor the code more cleanly, as Tom suggests -- it's not clear to me
quite how to do that without accepting a performance hit, though...

-Neil

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug#347548: DOMAIN CHECK constraint bypassed
Next
From: Philipp Reisner
Date:
Subject: Re: Endless loop in ExecNestLoop