Information regarding foriegn key constraint.

Started by meeta bhatealmost 25 years ago4 messagesbugs
Jump to latest
#1meeta bhate
mbhate@eng.utoledo.edu

Dear Sir,
I am a Graduate student at the University of Toledo.My Master's project
involves creating a database in PostgreSQL version 6.5.3.I was wondering
if I can use SERIAL key along with a PRIMARY key as follows:

create table ohiouniv (uid serial primary key,
uname varchar(45) not null,
ucity varchar(25) not null);

create table departments (deptid serial primary key,
deptshrtn varchar(10) not null,
deptfulln varchar(45) not null,
deptphone int8 unique not null check(deptphone>0));

When I tried giving the following for linking the above 2 tables:

create table univdept (uid integer references ohiouniv,
deptid integer references departments);

The error was:
create table/foreign key clause ignored; not yet implemented

Does this mean we cannot use the foreign key constraint in this version of
PostgreSQL, and if so, what is the alternative for the above problem.Please
let me know about this at your earliest convinience.
Thanks much!
Best Regards
Meeta Bhate
University of Toledo.
EECS Department.
Ph:419 450 3685.

#2Peter Eisentraut
peter_e@gmx.net
In reply to: meeta bhate (#1)
Re: Information regarding foriegn key constraint.

meeta bhate writes:

I am a Graduate student at the University of Toledo.My Master's project
involves creating a database in PostgreSQL version 6.5.3.I was wondering
if I can use SERIAL key along with a PRIMARY key as follows:

(This is not the right mailing list for "wondering".)

create table univdept (uid integer references ohiouniv,
deptid integer references departments);

The error was:
create table/foreign key clause ignored; not yet implemented

"Not implemented" really means that, but if you upgrade to the latest
version you will get foreign keys.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: meeta bhate (#1)
Re: Information regarding foriegn key constraint.

On Fri, 8 Jun 2001, meeta bhate wrote:

Dear Sir,
I am a Graduate student at the University of Toledo.My Master's project
involves creating a database in PostgreSQL version 6.5.3.I was wondering
if I can use SERIAL key along with a PRIMARY key as follows:

create table ohiouniv (uid serial primary key,
uname varchar(45) not null,
ucity varchar(25) not null);

create table departments (deptid serial primary key,
deptshrtn varchar(10) not null,
deptfulln varchar(45) not null,
deptphone int8 unique not null check(deptphone>0));

When I tried giving the following for linking the above 2 tables:

create table univdept (uid integer references ohiouniv,
deptid integer references departments);

The error was:
create table/foreign key clause ignored; not yet implemented

Does this mean we cannot use the foreign key constraint in this version of
PostgreSQL, and if so, what is the alternative for the above problem.Please
let me know about this at your earliest convinience.

FK constraints were added in 7.0, various fixes in 7.1 (with more
forthcoming). Your best bet would be to upgrade if possible. There was a
contrib module in 6.5 that did something basically fk (it didn't use the
references syntax and was installed manually as triggers).

#4meeta bhate
mbhate@eng.utoledo.edu
In reply to: Peter Eisentraut (#2)
Re: Information regarding foriegn key constraint.

Dear Sir,
Thanks a lot for your help.
Regards

-------------------------------------------------
MEETA BHATE
GRADUATE STUDENT,UNIVERSITY OF TOLEDO
2716 KENDALE #102
TOLEDO OH 43606
TEL:(419)-474-4208