Skip to content

Support for Multi-Column Foreign Keys #117

Open
@ondras

Description

@ondras

From [email protected] on October 15, 2010 15:42:08

It seems wwwsqldesigner is only implementing column constraint logic for foreign keys, but not table constraint logic and is thus only allowing single column constraints for foreign keys.

Support for Multi-Column Foreign Keys is missing.

Many databases support multicolumn primary keys. Foreign keys usually refer to a primary (or unique) key of a table, hence need to contain the same number and type of columns of the referenced key (for unique or single column primary keys, this is then a single column constraint).

ORACLE:

All foreign key columns referenced in constraint must be NOT NULL.

For definition of foreign keys in oracle DB, see http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/clauses002.htm#SQLRF01111 example: CONSTRAINT FK_EXAMPLE_1 FOREIGN KEY (column1, column2, column3) REFERENCES TABLE_1 ( column_x, column_y, column_z);

POSTGRESQL:
=========== http://www.postgresql.org/docs/9.0/static/sql-createtable.html CONSTRAINT FK_PGSQL_EXAMPLE_1 FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]

For postgresql it is possible to have some parts of the FK to be null depending on the MATCH type.

MYSQL:

(innodb). See: http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html MSSQL:

Table constraint. See Create Table syntax: http://msdn.microsoft.com/en-us/library/ms174979.aspx

Original issue: http://code.google.com/p/wwwsqldesigner/issues/detail?id=110

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions