Re: Checking Multiplicity Constraints and Retrieving Data from Error Messages - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Checking Multiplicity Constraints and Retrieving Data from Error Messages
Date
Msg-id 20051020120631.GG30631@svana.org
Whole thread Raw
In response to Re: Checking Multiplicity Constraints and Retrieving Data from Error Messages  (Ledina Hido <lh1101@ecs.soton.ac.uk>)
List pgsql-general
On Thu, Oct 20, 2005 at 12:44:53PM +0100, Ledina Hido wrote:
> I am not sure if CHECK constraints will work, as I don't think you
> can reference another table in one of those. And I think it might
> even not let you have a subquery (ie a select inside the check
> statement). So I don't know whether I would be able to use CHECK for
> that. Or am I being stupid and you actually can?

Well, you'll need to make a function that does the work and specify
that function as the check constraint. It's true that directly you
can't specify other tables. PostgreSQL can see inside functions to see
what you are doing...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Douglas McNaught
Date:
Subject: Re: Select all invalid e-mail addresses
Next
From: Hannes Dorbath
Date:
Subject: Re: Select all invalid e-mail addresses