From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Ledina Hido <lh1101(at)ecs(dot)soton(dot)ac(dot)uk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Checking Multiplicity Constraints and Retrieving Data from Error Messages |
Date: | 2005-10-20 12:06:36 |
Message-ID: | 20051020120631.GG30631@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)svana(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Hannes Dorbath | 2005-10-20 12:13:39 | Re: Select all invalid e-mail addresses |
Previous Message | Merlin Moncure | 2005-10-20 12:06:05 | Re: versions of oDBC driver |