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

Re: Bug#347548: DOMAIN CHECK constraint bypassed

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-bugs(at)postgresql(dot)org, 347548-forwarded(at)bugs(dot)debian(dot)org
Subject: Re: Bug#347548: DOMAIN CHECK constraint bypassed
Date: 2006-01-31 02:50:17
Message-ID: 1138675817.8835.29.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: 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



In response to

pgsql-bugs by date

Next:From: Philipp ReisnerDate: 2006-01-31 09:54:23
Subject: Re: Endless loop in ExecNestLoop
Previous:From: Tom LaneDate: 2006-01-31 01:45:28
Subject: Re: Bug#347548: DOMAIN CHECK constraint bypassed

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