2015-04-23 15:31 GMT-05:00 Patricia Recinos
<patricia.reci...@screencheckla.com>:
>
> Buenas tardes
>
> Pero esto funciona si lo hago de forma independiente pero si lo pongo en una 
> función me da error, realmente estoy iniciando con postgres y tengo dudas.
>
> Solo me funciona desde la línea de comandos.
>
>
> BEGIN;
>
> UPDATE accounts SET balance = balance - 100.00
>
>     WHERE name = 'Alice';
>
> SAVEPOINT my_savepoint;
>
> UPDATE accounts SET balance = balance + 100.00
>
>     WHERE name = 'Bob';
>
> -- oops ... forget that and use Wally's account
>
> ROLLBACK TO my_savepoint;
>
> UPDATE accounts SET balance = balance + 100.00
>
>     WHERE name = 'Wally';
>
> Commit;
>

Si estas incluyendo BEGIN, SAVEPOINT y COMMIT en la función ese es el error.
Tal vez te convenga leer
http://www.postgresql.org/docs/current/static/plpgsql-porting.html,
especialmente el punto 40.12.2.1. Implicit Rollback after Exceptions


-- 
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

-
Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda@postgresql.org)
Para cambiar tu suscripción:
http://www.postgresql.org/mailpref/pgsql-es-ayuda

Responder a