Received: from gnumed.dhs.org (modem59.malleenet.net.au [203.143.67.123] (may be forged)) by postgresql.org (8.11.3/8.11.4) with SMTP id f7JDJOP01213 for ; Sun, 19 Aug 2001 09:19:24 -0400 (EDT) (envelope-from hherb@malleenet.net.au) Received: (qmail 13054 invoked by uid 8); 19 Aug 2001 13:19:09 -0000 Received: from pc-00071.e-smith.gnumed.dhs.org (192.168.1.71, claiming to be "munin.gnumed.dhs.org") by bifrost.e-smith.gnumed.dhs.org with SMTP id smtpdmtSJMl; Sun, 19 Aug 2001 23:19:01 EST Content-Type: text/plain; charset="iso-8859-1" From: Horst Herb To: "Jeff Eckermann" Subject: Re: how to use record type Date: Sun, 19 Aug 2001 23:20:06 +1000 X-Mailer: KMail [version 1.2] References: <0108170824511W.01835@munin.gnumed.dhs.org> <009401c12727$71b3a150$279c10ac@INTERNAL> In-Reply-To: <009401c12727$71b3a150$279c10ac@INTERNAL> Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Message-Id: <01081923200626.01835@munin.gnumed.dhs.org> Content-Transfer-Encoding: 8bit X-Archive-Number: 200108/234 X-Sequence-Number: 4466 On Saturday 18 August 2001 00:18, you wrote: > I have encountered this problem (in a different context), and could not > find a way to insert entire rows/records in the way that you appear to > want. But it worked fine if I INSERTed explicitly, like: > INSERT INTO table VALUES (OLD.field1, OLD.field2, ..., OLD.fieldn); > That should work fine inside a plpgsql function. This is what I have been doing until recently. Rather ugly, as it is >250 different tables which need this. Meaning that I had to manually write the trigger functions for each table, attribute by attribute. At present, I solved the situation like that: - all tables that need the trigger function inherit a parent table - a python script scans all tables inheriting the parent table and then generates the trigger functions for them. I still execute the script manually after updating or inserting tables. - now I am trying to find out how to implement a trigger on the system tables that will fire my Python script automatically whenever a table inheriting this special parent table is altered or created. Sad that such an ugly hack is neccessary though. Horst