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@xxxxxxxxx> 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:
pgpuDLuRuFOIa.pgp
Description: PGP signature