Re: funciones y ROLLBACK

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Victor Lopez" <d01m01a2000(at)gmail(dot)com>
Cc: Postgres <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: funciones y ROLLBACK
Date: 2007-05-06 04:06:09
Message-ID: c2d9e70e0705052106x3092689bq806cf1e056876de0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 5/5/07, Victor Lopez <d01m01a2000(at)gmail(dot)com> wrote:
> Pero si el BEGIN de una función genera el BEGIN de una transacción, y
> el END; de una función genera el END; de una transacción ...
>
> Como decían en otro sitio ...
>
> Si dice 'cuac', tiene plumas de pato,patas de pato, pico de pato, etc ...
> Aunque no sea un pato ...
>

añado esto solo porque resulta mas claro que mi ejemplo anterior... y
me imagino que lo critacaran menos =)

http://www.postgresql.org/docs/8.2/static/plpgsql-structure.html
"
It is important not to confuse the use of BEGIN/END for grouping
statements in PL/pgSQL with the database commands for transaction
control. PL/pgSQL's BEGIN/END are only for grouping; they do not start
or end a transaction. Functions and trigger procedures are always
executed within a transaction established by an outer query — they
cannot start or commit that transaction, since there would be no
context for them to execute in. However, a block containing an
EXCEPTION clause effectively forms a subtransaction that can be rolled
back without affecting the outer transaction. For more about that see
Section 37.7.5.
"

y por ultimo funciones en otros lenguajes no usan BEGIN/END... no se
ejecutan dentro de una transaccion entonces?

http://www.postgresql.org/docs/8.2/static/plperl-funcs.html

CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS $$
if ($_[0] > $_[1]) { return $_[0]; }
return $_[1];
$$ LANGUAGE plperl;

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2007-05-06 04:22:40 Re: Conectarse desde Visual FoxPro usando ADO
Previous Message Jaime Casanova 2007-05-06 03:59:30 Re: funciones y ROLLBACK