Skip site navigation (1) Skip section navigation (2)

constraint question

From: mwaples(at)optusnet(dot)com(dot)au
To: Pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: constraint question
Date: 2001-01-03 10:37:27
Message-ID: 3A5300E7.67FBA9D7@optusnet.com.au (view raw or flat)
Thread:
Lists: pgsql-novice
I have a table category with columns -
category_id , main_id

I would like to check that the main_id value exists in category_id in
any row of the table category.

Is it possible to have a foreign key referring to the current table ?
Or should I be using a trigger to do it ?

I'm thinking I have to use a trigger to do it - but want to make sure.

In response to

Responses

pgsql-novice by date

Next:From: mwaplesDate: 2001-01-03 11:25:32
Subject: Re: constraint question
Previous:From: David MerrillDate: 2001-01-03 03:32:21
Subject: Re: ColdFusion sez this is valid SQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group