Questions concerning check constraints - Mailing list pgsql-general

From Christian Rengstl
Subject Questions concerning check constraints
Date
Msg-id 472AF613.90AD.0080.0@klinik.uni-regensburg.de
Whole thread Raw
Responses Re: Questions concerning check constraints  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
Hi list,

I have two question concerning check constraints:
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.
2) Is it possible to issue custom error messages in case a constraint
is violated?

Thanks!



Christian Rengstl M.A.
Klinik und Poliklinik für Innere Medizin II
Kardiologie - Forschung
Universitätsklinikum Regensburg
B3 1.388
Franz-Josef-Strauss-Allee 11
93053 Regensburg
Tel.: +49-941-944-7230




pgsql-general by date:

Previous
From: "Moiz Kothari"
Date:
Subject: Re: Number to Words Conversion
Next
From: Oleg Bartunov
Date:
Subject: Re: Improve Search