pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14241: i want to do commit and rollback in one plpgsql block..
3+ messages / 2 participants
[nested] [flat]

* BUG #14241: i want to do commit and rollback in one plpgsql block..
@ 2016-07-11 07:32  zzia88@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: zzia88@gmail.com @ 2016-07-11 07:32 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14241
Logged by:          Zubair Alam
Email address:      zzia88@gmail.com
PostgreSQL version: 9.5.3
Operating system:   windows7-x64(64 bit)
Description:        

CREATE OR REPLACE FUNCTION  DELROLL()
	RETURNS INT AS $V_CHOICE$
BEGIN
           IF V_CHOICE=1 THEN
                           DELETE FROM ITEMS
                           WHERE itemid=4;
                   --DBMS_OUTPUT.PUT_LINE('EMPLYEE RECORD DELETED
SUCESSFULLY');
                   END IF;
           IF V_CHOICE=2 THEN
                ROLLBACK;
		COMMIT;
           ---DBMS_OUTPUT.PUT_LINE('ROLL BACK COMPLETED  SUCESSFULLY');
           END IF;
           RETURN V_CHOICE;
   END;
   $V_CHOICE$
   LANGUAGE PLPGSQL;

when i enter my choice 2 i.e for rollback and commit then that time this
error is generating.
ERROR:  current transaction is aborted, commands ignored until end of
transaction block

********** Error **********

ERROR: current transaction is aborted, commands ignored until end of
transaction block
SQL state: 25P02



 please give me perfect solution for using  commit and rollback in one 
plpgsql program block.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14241: i want to do commit and rollback in one plpgsql block..
@ 2016-07-11 13:14  David G. Johnston <david.g.johnston@gmail.com>
  parent: zzia88@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2016-07-11 13:14 UTC (permalink / raw)
  To: zubair alam <zzia88@gmail.com>; +Cc: pgsql-bugs

On Mon, Jul 11, 2016 at 3:32 AM, <zzia88@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14241
> Logged by:          Zubair Alam
> Email address:      zzia88@gmail.com
> PostgreSQL version: 9.5.3
> Operating system:   windows7-x64(64 bit)
> Description:
>
>
​This seems to be a duplicate of bug # 14240 which has already been
responded to.

David J.
​

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14241: i want to do commit and rollback in one plpgsql block..
@ 2016-07-11 13:48  David G. Johnston <david.g.johnston@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2016-07-11 13:48 UTC (permalink / raw)
  To: zubair alam <zzia88@gmail.com>; pgsql-bugs

On Mon, Jul 11, 2016 at 9:40 AM, zubair alam <zzia88@gmail.com> wrote:

> Please give me exact answer. i am waiting for solution. or tell how i have
> to use in commit and rollback in one plpgsql block.
> if you have knowledge  then give me exact answer.
>
> On Mon, Jul 11, 2016 at 4:14 PM, David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>
>> On Mon, Jul 11, 2016 at 3:32 AM, <zzia88@gmail.com> wrote:
>>
>>> The following bug has been logged on the website:
>>>
>>> Bug reference:      14241
>>> Logged by:          Zubair Alam
>>> Email address:      zzia88@gmail.com
>>> PostgreSQL version: 9.5.3
>>> Operating system:   windows7-x64(64 bit)
>>> Description:
>>>
>>>
>> ​This seems to be a duplicate of bug # 14240 which has already been
>> responded to.
>>
>> David J.
>> ​
>>
>>
>
​To quote the other reply:

"
Does not seem like a bug, IIRC commit/rollback is not allowed inside
functions ( savepoints are, you may try to work with them ).
​"

I'll just confirm this is true.

​That is as exact as you are going to get - at least from me.

​If you want more I suggest you reply to the original thread with
additional detail about what you are trying to accomplish.  As it stands
you state you need to do something which is not possible in PostgreSQL.
Without context it is difficult to suggest alternatives.

Also, do not reply to people personally.  These are public lists and
generally the people contributing to them either want to share the
information broadly or, as in this case, rely upon others to share in the
work.  I have re-added pgsql-bugs on this reply.

​Also, it is customary to inline or bottom-post on these list  - just like
Francisco and I both did in our replies to your initial bug reports.

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-07-11 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11 07:32 BUG #14241: i want to do commit and rollback in one plpgsql block.. zzia88@gmail.com
2016-07-11 13:14 ` David G. Johnston <david.g.johnston@gmail.com>
2016-07-11 13:48   ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox