]> granicus.if.org Git - postgresql/commit
Hi All,
authorBruce Momjian <bruce@momjian.us>
Mon, 15 Mar 1999 00:34:53 +0000 (00:34 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 15 Mar 1999 00:34:53 +0000 (00:34 +0000)
commit98ad3fcfaf32e23959b44ec3f06f27555eaa5605
tree35b3029b9ceee4ad2d5ae66d3cb943dd7db70ee2
parentdb42533eaea16758132defb48915a0425f613128
Hi All,
I've changed the check_primary_key() function code to allow for either
the "automatic insert key rule" or "dependent insert key rule".
Previously it restricted the addtion of a child entry if the
corresponding parent entry was not there. Now if the option is
"automatic" it will add an entry in the parent too ( it will be
successful if there are no no-null fields in the parent apart from the
primary key).
The way to use it now is:
:/*
 * check_primary_key () -- check that key in tuple being
inserted/updated
 *                       references existing tuple in "primary" table.
 * Though it's called without args You have to specify referenced
 * table/keys while creating trigger:  key field names in triggered
table,
 * referenced table name, referenced key field names,type of action
[automatic|dependent]:
 * EXECUTE PROCEDURE
 * check_primary_key ('Fkey1', 'Fkey2', 'Ptable', 'Pkey1', 'Pkey2',
'[automatic|dependent]').
 */
I am attaching the new ../contrib/spi/refint.c file which will do this.
I will be glad to help in case of any problems.

- Anand.
contrib/spi/refint.c