Questions concerning check constraints

From: "Christian Rengstl" <Christian(dot)Rengstl(at)klinik(dot)uni-regensburg(dot)de>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Questions concerning check constraints
Date: 2007-11-02 09:04:06
Message-ID: 472AF613.90AD.0080.0@klinik.uni-regensburg.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2007-11-02 10:08:58 Re: Improve Search
Previous Message Moiz Kothari 2007-11-02 08:48:01 Re: Number to Words Conversion