Thread: accessing text of the query in a rule

accessing text of the query in a rule

From
"Toni Casueps"
Date:
I am making rules for a table and I want to know what values or variables
can I use apart from the "new..." and old... fields, for example I would
like to read the SQL query that the user wrote that caused this rule to
execute. Can this be done?



Re: accessing text of the query in a rule

From
Richard Huxton
Date:
Toni Casueps wrote:
> I am making rules for a table and I want to know what values or
> variables can I use apart from the "new..." and old... fields, for
> example I would like to read the SQL query that the user wrote that
> caused this rule to execute. Can this be done?

No. And there's isn't necessarily an original query that's relevant.
What about a rule activated due to actions taken by a trigger. Are you
still interested in the user's query, or the query the trigger issued?

If there's a particular problem you're trying to solve, the details
might well give someone enough info to help.

--
   Richard Huxton
   Archonet Ltd

Re: accessing text of the query in a rule

From
Jaime Casanova
Date:
On 12/2/05, Toni Casueps <casueps@hotmail.com> wrote:
> I am making rules for a table and I want to know what values or variables
> can I use apart from the "new..." and old... fields, for example I would
> like to read the SQL query that the user wrote that caused this rule to
> execute. Can this be done?
>

You can't see the original query but have a lot of information much relevant....

C triggers: http://www.postgresql.org/docs/current/static/trigger-interface.html
In plpgsql: http://www.postgresql.org/docs/current/static/plpgsql-trigger.html
In pltcl: http://www.postgresql.org/docs/current/static/pltcl-trigger.html
In plperl: http://www.postgresql.org/docs/current/static/plperl-triggers.html
In plpython: http://www.postgresql.org/docs/current/static/plpython-trigger.html

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)