about creating DB

Started by hirokoabout 25 years ago4 messagesgeneral
Jump to latest
#1hiroko
h_ogawa@rnk.co.jp

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.

#2Brett W. McCoy
bmccoy@chapelperilous.net
In reply to: hiroko (#1)
Re: about creating DB

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

#3will trillich
will@serensoft.com
In reply to: hiroko (#1)
Re: about creating DB

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!

#4Limin Liu
limin@pumpkinnet.com
In reply to: will trillich (#3)
Re: about creating DB

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