Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C4892635984 for ; Wed, 8 Jul 2009 08:21:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 90593-03-2 for ; Wed, 8 Jul 2009 08:20:51 -0300 (ADT) Received: from mx1.hub.org (unknown [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id BA05063469F for ; Wed, 8 Jul 2009 07:36:38 -0300 (ADT) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by mx1.hub.org (Postfix) with ESMTP id 1C9DB125B658 for ; Wed, 8 Jul 2009 07:36:36 -0300 (ADT) Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id D3AAF9400B5 for ; Wed, 8 Jul 2009 12:36:27 +0200 (CEST) Received: from [192.168.123.13] (tok69-1-82-67-35-128.fbx.proxad.net [82.67.35.128]) by smtp1-g21.free.fr (Postfix) with ESMTP id CE6769400CC for ; Wed, 8 Jul 2009 12:36:24 +0200 (CEST) Message-ID: <4A547696.50704@free.fr> Date: Wed, 08 Jul 2009 12:36:06 +0200 From: nha Organization: Lyon, Rhone, France User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Recording how a table is used References: <11c0133d0906292347q4c65cfe2m7b658232d0b13a9f@mail.gmail.com> <4A546728.4050904@free.fr> In-Reply-To: <4A546728.4050904@free.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=0 required=5 tests=RDNS_NONE=0.1 X-Spam-Level: X-Archive-Number: 200907/35 X-Sequence-Number: 32776 Hello, Le 8/07/09 11:30, nha a écrit : > Hello, > > Le 30/06/09 8:47, Daniel Gordon a écrit : >> I'm trying to record the results of a select statement into a separate >> table. I need the information selected, the column it was stored in, >> the table it was stored in, and the query that selected it. >> [...] >> Here is the table I'm trying to fill, in case it is useful >> >> create table sql_query_data_log ( >> id serial, >> create_ time timestamp DEFAULT now(), >> query varchar, >> table text, >> column text, >> >> data varchar >> ); >> [...] > Another crude alternative may be based on triggers as you mentioned. > Triggers may be created on each table for each possible triggered event > (before, after). > [...] Rules may be also appropriate (more than triggers?). This page gives some examples: http://www.postgresql.org/docs/8.3/interactive/rules-update.html Regards. -- nha / Lyon / France.