Обсуждение: Comment 1987 added to page ddl-inherit.html of version 7.4

Поиск
Список
Период
Сортировка

Comment 1987 added to page ddl-inherit.html of version 7.4

От
nobody
Дата:
Author: Diego Zuccato <diego@otello.alma.unibo.it>
----
Replicating PRIMARY KEY in child tables allows only referencing 'em from other tables. It doesn't solve the "duplicated
primarykey" problem in the parent table. The only way I could find is adding : 
CREATE OR REPLACE FUNCTION base_notexists(integer)
 RETURNS boolean
 STABLE
 LANGUAGE 'SQL'
 AS 'SELECT NOT EXISTS(SELECT id FROM base WHERE id=$1)';
and the constraint
 CHECK (base_notexists(id))

If only it could be possible to reference an already existing index...
----
Manual page: http://wwwmaster.postgresql.org/docs/7.4/interactive/ddl-inherit.html
Reject:      http://wwwmaster.postgresql.org/admin/comments.php?action=reject&id=1987
Edit:        http://wwwmaster.postgresql.org/admin/comment-edit.php?id=1987
Delete:      http://wwwmaster.postgresql.org/admin/comments.php?action=delete&id=1987