Re: How can I get one OLD.* field in a dynamic query inside a trigger function ?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruno Baguette <bruno(dot)baguette(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can I get one OLD.* field in a dynamic query inside a trigger function ?
Date: 2009-10-24 20:57:27
Message-ID: 162867790910241357m64acc35en5a8c1789f5725911@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/10/24 Bruno Baguette <bruno(dot)baguette(at)gmail(dot)com>:
> Le 24/10/09 22:09, Pavel Stehule a écrit :
>>
>> you can use plperl or plpython for this task.
>>
>> Pavel
>
> re-Hello Pavel,
>
> I always used plpgsql because I *thought* it was the most powerfull
> procedural language for stored procedures in PostgreSQL.

plpgsql is best language for stored procedures, but simply it is not
for all. There are some issue still, but some significant limits are
removed in 8.4.

>
> The fact that PL/pgSQL is most documented than PL/Tcl and PL/Perl (and
> PL/Python *seems* to have very poor documentation) has probably made me
> wrong.
>
> 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.

>
> Can you explain me why does PL/Perl and PL/Python can does this task (using
> OLD in a dynamic query) where PL/pgSQL can't ?

External procedures (like procedures in plperl or plpython) has not
100% integrated SQL. Next, SQL row is mapped to perl's array and it
should be iterated. Plpgsql is similar to classic programming
languages. In mostly older languages you cannot iterate over
recordset.. plpgsql is static language like C, Pascal, ADA. Perl or
Python are dynamic languages, so you can do some tasks very simple.
And other not, because these languages are only on partially
integrated with SQL.

>
> Once again, thanks a lot for your tips ! :-)

with pleasure

Pavel
>
> Kind regards,
>
> --
> Bruno Baguette - bruno(dot)baguette(at)gmail(dot)com
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-10-24 23:26:18 Re: recovery mode
Previous Message Scott Marlowe 2009-10-24 20:53:23 Re: is postgres a good solution for billion record data