Re: Can I catch sentences in SQL using triggers?

Lists: pgsql-general
From: Richard Huxton <dev(at)archonet(dot)com>
To: Manuel García <mgarciah(at)ife(dot)org(dot)mx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Can I catch sentences in SQL using triggers?
Date: 2005-06-01 15:38:10
Message-ID: 429DD662.2020801@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Manuel García wrote:
> Hello Everybody, somebody knows if its possible to catch one
> sentences in full SQL using the triggers, or maybe somebody have any
> idea about to how do it?
>
> I am using postgreSQL 7.3 on fedora core 1

If I understand, you want to access the query, e.g. "SELECT * FROM
my_table" from within a trigger function. The answer is no. If you can
describe what you're trying to do, someone may be able to help though.

--
Richard Huxton
Archonet Ltd


From: Manuel García <mgarciah(at)ife(dot)org(dot)mx>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Can I catch sentences in SQL using triggers?
Date: 2005-06-01 15:52:24
Message-ID: 034501c566c1$e78e9690$a018000a@mercurio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello Everybody, somebody knows if its possible to catch one sentences in full SQL using the triggers, or maybe somebody have any idea about to how do it?

I am using postgreSQL 7.3 on fedora core 1

Thanks in advanced

Manuel


From: Manuel García <mgarciah(at)ife(dot)org(dot)mx>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can I catch sentences in SQL using triggers?
Date: 2005-06-01 16:53:37
Message-ID: 037501c566ca$74d5e910$a018000a@mercurio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Ok. Richard, that is that I need to do, I need to create a log table with
all the information that is changed on every row that was update, delete or
insert, additionally I must be record the user that do that. At this point I
don't have troubles I can do that, but I need to get the full sentence
because I want to use that to update other database but only apply the last
changes, in the case of insert of course doesn't exist problem but in the
case of dalete and update yes. That is because I need to catch the sentences
of insert update an delete but full.

Thanks in advanced.

Manuel
----- Original Message -----
From: "Richard Huxton" <dev(at)archonet(dot)com>
To: "Manuel García" <mgarciah(at)ife(dot)org(dot)mx>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, June 01, 2005 9:38 AM
Subject: Re: [GENERAL] Can I catch sentences in SQL using triggers?

Manuel García wrote:
> Hello Everybody, somebody knows if its possible to catch one
> sentences in full SQL using the triggers, or maybe somebody have any
> idea about to how do it?
>
> I am using postgreSQL 7.3 on fedora core 1

If I understand, you want to access the query, e.g. "SELECT * FROM
my_table" from within a trigger function. The answer is no. If you can
describe what you're trying to do, someone may be able to help though.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


From: Richard Huxton <dev(at)archonet(dot)com>
To: Manuel García <mgarciah(at)ife(dot)org(dot)mx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Can I catch sentences in SQL using triggers?
Date: 2005-06-01 17:07:19
Message-ID: 429DEB47.1050103@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Manuel García wrote:
> Ok. Richard, that is that I need to do, I need to create a log table
> with all the information that is changed on every row that was update,
> delete or insert, additionally I must be record the user that do that.
> At this point I don't have troubles I can do that, but I need to get the
> full sentence because I want to use that to update other database but
> only apply the last changes, in the case of insert of course doesn't
> exist problem but in the case of dalete and update yes. That is because
> I need to catch the sentences of insert update an delete but full.

Sounds like you want to use one of the existing replication solutions -
perhaps try a search on slony.

PS - merely tracking the top-level SQL isn't enough to guarantee you can
reproduce the changes to the database.
--
Richard Huxton
Archonet Ltd