Issue Details (XML | Word | Printable)

Key: NUCRDBMS-541
Type: Task Task
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Support definition of foreign keys in CREATE TABLE statement

Created: 02/Jul/11 12:05 PM   Updated: 23/Aug/11 03:23 PM
Component/s: Schema
Affects Version/s: None
Fix Version/s: None


 Description  « Hide
Some RDBMS allow specification of FOREIGN KEYs at the end of a CREATE TABLE statement. We should allow it.

CREATE TABLE TBL1
(
   ID INT NOT NULL,
   COL1 INT,
   FOREIGN KEY (COL1) REFERENCES TBL2 (COLX)
)

The complication is that the related table needs to exist, so need to introduce ordering into table creation whereas without this we don't (and just send the CREATE FK statement when both tables exist)

Andy Jefferson made changes - 23/Aug/11 03:23 PM
Field Original Value New Value
Assignee Andy Jefferson [ andy ]
Priority Major [ 3 ] Minor [ 4 ]
Description Some RDBMS allow specification of FOREIGN KEYs at the end of a CREATE TABLE statement. We should allow it.

CREATE TABLE TBL1
(
   ID INT NOT NULL,
   COL1 INT,
   FOREIGN KEY (COL1) REFERENCES TBL2 (COLX)
)
Some RDBMS allow specification of FOREIGN KEYs at the end of a CREATE TABLE statement. We should allow it.

CREATE TABLE TBL1
(
   ID INT NOT NULL,
   COL1 INT,
   FOREIGN KEY (COL1) REFERENCES TBL2 (COLX)
)

The complication is that the related table needs to exist, so need to introduce ordering into table creation whereas without this we don't (and just send the CREATE FK statement when both tables exist)