Thread: about creating DB
hi all
we're switching our system from Unix-version to Linux-version,
and from SQLplus to PostgreSQL
the questions are about CREATING DB
I found that FOREIGN KEY clause, which we need for our DB, is not implemented on PostgreSQL.
that means you can't use DELETE CASCADE clause neither.
is there some alternative way for them????
llike, can't you use CHECK clause instead for them???
thankyou.
On Fri, 23 Mar 2001, hiroko wrote: > we're switching our system from Unix-version to Linux-version, > and from SQLplus to PostgreSQL > > the questions are about CREATING DB > > I found that FOREIGN KEY clause, which we need for our DB, is not > implemented on PostgreSQL. > that means you can't use DELETE CASCADE clause neither. > > is there some alternative way for them???? > llike, can't you use CHECK clause instead for them??? Foreign keys have been available in PostgreSQL since version 7.0. Please see the online documentation. -- Brett http://www.chapelperilous.net/btfwk/ ------------------------------------------------------------------------ You can do more with a kind word and a gun than with just a kind word. - Al Capone
On Fri, Mar 23, 2001 at 07:41:51PM +0900, hiroko wrote: > hi all > > we're switching our system from Unix-version to Linux-version, > and from SQLplus to PostgreSQL > > the questions are about CREATING DB > > I found that FOREIGN KEY clause, which we need for our DB, is not > implemented on PostgreSQL. > that means you can't use DELETE CASCADE clause neither. i'm using 7.0.3 (on debian potato)-- create table lookup ( major serial, minor int4, other ... ); create table kahunamydata ( id serial, ... MAJOR int4, MINOR int4, yada ..., FOREIGN KEY(major,minor) REFERENCES lookup(major,minor) ON DELETE CASCADE, ... primary key(id) ); -- It is always hazardous to ask "Why?" in science, but it is often interesting to do so just the same. -- Isaac Asimov, 'The Genetic Code' will@serensoft.com http://newbieDoc.sourceforge.net/ -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
> the questions are about CREATING DB > > I found that FOREIGN KEY clause, which we need for our DB, is not > implemented on PostgreSQL. I believe, it's implemented called REFERENCES http://www.postgresql.org/devel-corner/docs/postgres/sql-createtable.html > that means you can't use DELETE CASCADE clause neither. This one I am not sure, but seems can be implemented by adding one trigger http://www.postgresql.org/devel-corner/docs/postgres/sql-createtrigger.html Have fun -- LM Liu