| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Najib Abi Fadel" <nagib(dot)abi-fadel(at)usj(dot)edu(dot)lb> |
| Cc: | "generalpost" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Using SUBSELECT in CHECK expressions |
| Date: | 2003-11-04 21:26:38 |
| Message-ID: | 25124.1067981198@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
"Najib Abi Fadel" <nabifadel(at)usj(dot)edu(dot)lb> writes:
> Is postgres going to support in a future release the use of SUBSELECT in a =
> CHECK expression ??
Not very likely. To my mind, such a constraint would imply rechecking
whenever the table(s) read by the sub-SELECT change, not only when a
row of the constrained table changes. I don't know any reasonably
efficient implementation of that behavior. We might figure out how to
do it eventually, but don't hold your breath.
If you are satisfied with only a one-directional constraint (apply the
check just when the constrained table is modified), you can have it today.
Just put the SELECT into a function that's called by the CHECK
expression.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2003-11-04 21:34:04 | Re: SELECT question |
| Previous Message | Stephan Szabo | 2003-11-04 21:21:56 | Re: Foreign Key to Inherited table |