From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Erik Wienhold <ewie(at)ewie(dot)name> |
Cc: | Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: rollback to savepoint issue |
Date: | 2023-09-04 15:12:50 |
Message-ID: | 8991f350-d697-c664-5637-beb6f789f86b@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 9/4/23 07:56, David G. Johnston wrote:
> On Monday, September 4, 2023, Erik Wienhold <ewie(at)ewie(dot)name
> <mailto:ewie(at)ewie(dot)name>> wrote:
>
> On 04/09/2023 11:51 CEST Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com
> <mailto:domenico(dot)l76(at)gmail(dot)com>> wrote:
>
> > I can't use the savepoint and rollback to savepoint clause.
> > I've found some similar problems around on the web, but I can't
> catch the
> > good way to proceed.
> >
> > What I'm trying to do is:
> > * compare new set of attribute with older
> > * if some attributes are part of old set and not in the new
> one: delete
> > the old
> > * but if parameter "on_misisng_delete" is false rollback delete
> command
> > and rais exception
> > The original code in embedded in a function, but the problem is
> the same:
>
> Transaction control is not possible in functions. Only in
> procedures (CALL)
> and DO blocks.
>
>
> Then explain why the original savepoint command wasn’t a syntax, or
> runtime, error? Plus, the error is syntax, usually when you try
> something that exists but is disallowed the system gives you some kind
> of invalid state exception at runtime,
Maybe this?:
https://www.postgresql.org/docs/current/sql-do.html
"If DO is executed in a transaction block, then the procedure code
cannot execute transaction control statements. Transaction control
statements are only allowed if DO is executed in its own transaction."
>
> David J.
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Erik Wienhold | 2023-09-04 15:22:23 | Re: rollback to savepoint issue |
Previous Message | Tom Lane | 2023-09-04 14:58:06 | Re: rollback to savepoint issue |