mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
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.
This directory contains the contribution functions or tools. --------------------------------------------------------------------------- apache_logging - Getting Apache to log to PostgreSQL by Terry Mackintosh <terry@terrym.com> array - Array iterator functions by Massimo Dal Zotto <dz@cs.unitn.it> datetime - Date & time functions by Massimo Dal Zotto <dz@cs.unitn.it> earthdistance - Operator for computing earth distance for two points by Hal Snyder <hal@vailsys.com> findoidjoins - Finds the joins used by oid columns by examining the actual values in the oid columns and row oids. by Bruce Momjian <root@candle.pha.pa.us> fulltextindex - Full text indexing using triggers by Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl> int8 - 64-bit integer arithmetic for Postgres by Thomas G. Lockhart <Thomas.Lockhart@jpl.nasa.gov> isbn_issn - PostgreSQL type extensions for ISBN (books) and ISSN (serials) by Garrett A. Wollman <wollman@khavrinen.lcs.mit.edu> linux - Start postgres back end system by Thomas Lockhart <lockhart@alumni.caltech.edu> lo - Large Object maintenance by Peter Mount <peter@retep.org.uk> miscutil - Postgres assert checking and various utility functions by Dal Zotto <dz@cs.unitn.it> mSQL-interface - mSQL API translation library by Aldrin Leal <aldrin@americasnet.com> noupdate - trigger to prevent updates on single columns plpgsql - Postgres procedural language by Jan Wieck <jwieck@debis.com> pginterface - A crude C/4GL by Bruce Momjian <root@candle.pha.pa.us> soundex - Prototype for soundex function spi - A general trigger function autoinc() and so on. string - C-like input/output conversion routines for strings by Massimo Dal Zotto <dz@cs.unitn.it> unixdate - Conversions from integer to datetime by Thomas Lockhart <lockhart@alumni.caltech.edu> userlock - User locks by Massimo Dal Zotto <dz@cs.unitn.it>