Search Postgresql Archives

Re: Questions concerning check constraints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 02, 2007 at 10:04:06AM +0100, Christian Rengstl wrote:
> 1) Is it possible to refer to a column in a different table, ie
> entering a value in mytable.x should only be allowed if mytable2.y=1 for
> example? I know that it is possible to use triggers to do that, but I
> think adding a simple check constraint might be simpler.

you would need to make a wrapper function for the actual checking, and
then add check (function(column) = true) or something like this.

> 2) Is it possible to issue custom error messages in case a constraint
> is violated?

if you have function based checks - sure, "raise exception"

depesz

-- 
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA.  here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux