Search Postgresql Archives

Re: Checking of constraints via subqueries?

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

 



Michael Fuhr wrote:
On Thu, Feb 17, 2005 at 07:31:42PM +0100, Martijn van Oosterhout wrote:

On Thu, Feb 17, 2005 at 11:03:58AM -0700, Michael Fuhr wrote:

In experiments I've defined a domain's CHECK expression to call a
function that makes queries.  It worked in simple tests; I don't
know if it'll work in the general case.

The problem is basically that modifying a table elsewhere could have the effect of invalidating the entries in the table being checked.


Yeah, that's the kind of thing that concerned me.  I meant to ask
the OP the usual question:

What problem are you trying to solve?

No problem actually.

Realising a constraint via a CHECK (<subquery>) is a decision made by the developer. So the developer has to make sure that this fits in the whole picture and works the intended way.
I'm thinking about the feature, and not about whether the use of this feature is dangerous or not.
My starting point was the thought of using this for checking in CREATE DOMAIN.
I see that the ubiquitous triggers could help (in an indirect way, being called with every INSERT or UPDATE of a row with that domain, but is this generic?). The other (subquery) option looks quite more elegant (and generic). And that may be the reason why it is mentioned in the docs: it seems to be an elegant and natural way the check a domain.


Best regards,
	Wolfgang


---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly

[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