Le 24/10/09 22:57, Pavel Stehule a écrit :
2009/10/24 Bruno Baguette <bruno.baguette@xxxxxxxxx>:
Which one would you advise me to learn and use, instead of PL/pgSQL ?
It depends on what you are know (if you known better perl or pthon).
Usually I using mainly plpgsql and on some functions plperl and C.
plpgsql is good language as glue of SQL statements, plperl is good for
IO and CPAN libraries, and C should help with some processor intensive
functions.
Hello Pavel !
I've read the doc' about plperl and plpython, since I have notion of both.
Because plpython is not a trusted language, I finally took plperl.
In case somebody else does look for the same thing as I was looking for,
here's the new trigger function, rewritten using plperl :
####################################
CREATE OR REPLACE FUNCTION delete_acl_trigger() RETURNS trigger AS
$delete_acl_trigger$
if($_TD->{argc}>0)
{
for(my $i=0; $i < $_TD->{argc} ; $i++)
{
my $acl_id = $_TD->{old}{$_TD->{"args"}[i]};
my $rv = spi_exec_query("SELECT delete_acl($acl_id);");
# DEBUG TOOLS
# my $status = $rv->{status};
# elog(NOTICE, 'RESULTAT : '.$status);
}
return;
}
else
{
return;
}
$delete_acl_trigger$ LANGUAGE plperl;
####################################
Do I have to mention that it does perfectly what I expected ? :-)
If you have any comments or tips about that function, feel free to do so
in order to improve it ! :-)
Pavel, many thanks for your tips and explanations !
They were very helpfull ! :-)
Kind regards,
--
Bruno Baguette - bruno.baguette@xxxxxxxxx
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general