pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Transactions within a function
5+ messages / 5 participants
[nested] [flat]

* Transactions within a function
@ 2001-07-06 12:40 Daniel Åkerud <zilch@home.se>
  2001-07-06 13:23 ` Re: Transactions within a function Jan Wieck <JanWieck@Yahoo.com>
  2001-07-06 13:32 ` Re: Transactions within a function Doug McNaught <doug@wireboard.com>
  2001-07-06 13:47 ` Re: Transactions within a function Alex Pilosov <alex@pilosoft.com>
  2001-07-06 14:22 ` Re: Transactions within a function Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 4 replies; 5+ messages in thread

From: Daniel Åkerud @ 2001-07-06 12:40 UTC (permalink / raw)
  To: PostgreSQL-general <pgsql-general@postgresql.org>

Do the BEGIN and END in a function also indicate that it is done in a transaction?
Or can you put another BEGIN TRANSACTION; END TRANSACTION; in there?

---
Daniel Åkerud

[ Don't underestimate the power of stupid people in large groups]

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

* Re: Transactions within a function
  2001-07-06 12:40 Transactions within a function Daniel Åkerud <zilch@home.se>
@ 2001-07-06 13:23 ` Jan Wieck <JanWieck@Yahoo.com>
  3 siblings, 0 replies; 5+ messages in thread

From: Jan Wieck @ 2001-07-06 13:23 UTC (permalink / raw)
  To: Daniel Åkerud <zilch@home.se>; +Cc: PostgreSQL-general <pgsql-general@postgresql.org>

Daniel Åkerud wrote:
> Do the BEGIN and END in a function also indicate that it is done in a transaction?
> Or can you put another BEGIN TRANSACTION; END TRANSACTION; in there?

    The  BEGIN  and  END  keywords in PL/pgSQL have absolutely no
    transactional meaning. They group statements into blocks with
    the  possibility  of  named blocks using the <<label>> syntax
    and then beeing able to EXIT  up  multiple  block  levels  at
    once.

    Since  every  SQL statement sent to the backend outside of an
    explicit transaction block has it's own implicit  transaction
    and   we   don't   have  subtransactions  yet,  there  is  no
    possibility for transaction control inside of functions.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




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

* Re: Transactions within a function
  2001-07-06 12:40 Transactions within a function Daniel Åkerud <zilch@home.se>
@ 2001-07-06 13:32 ` Doug McNaught <doug@wireboard.com>
  3 siblings, 0 replies; 5+ messages in thread

From: Doug McNaught @ 2001-07-06 13:32 UTC (permalink / raw)
  To: Daniel Åkerud <zilch@home.se>; +Cc: PostgreSQL-general <pgsql-general@postgresql.org>

Daniel Åkerud <zilch@home.se> writes:

> Do the BEGIN and END in a function also indicate that it is done in a
> transaction?  Or can you put another BEGIN TRANSACTION; END
> TRANSACTION; in there?

Please don't post in HTML.

A function is always executed within a transaction--either an explicit 
one (where the user issues BEGIN TRANSACTION) or the implicit
transaction created by issuing a single SQL statememt.  Since PG
doesn't allow nested transactions, you can't have a transaction inside 
a function.

-Doug
-- 
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan



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

* Re: Transactions within a function
  2001-07-06 12:40 Transactions within a function Daniel Åkerud <zilch@home.se>
@ 2001-07-06 13:47 ` Alex Pilosov <alex@pilosoft.com>
  3 siblings, 0 replies; 5+ messages in thread

From: Alex Pilosov @ 2001-07-06 13:47 UTC (permalink / raw)
  To: Daniel Åkerud <zilch@home.se>; +Cc: PostgreSQL-general <pgsql-general@postgresql.org>

On Fri, 6 Jul 2001, [iso-8859-1] Daniel Åkerud wrote:

> Do the BEGIN and END in a function also indicate that it is done in a
> transaction? Or can you put another BEGIN TRANSACTION; END
> TRANSACTION; in there?

No. Functions cannot start/stop transactions, as postgresql does not
currently support nested transactions. BEGIN/END are pascalish/adaish
things identical to { and } in C.

-alex




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

* Re: Transactions within a function
  2001-07-06 12:40 Transactions within a function Daniel Åkerud <zilch@home.se>
@ 2001-07-06 14:22 ` Peter Eisentraut <peter_e@gmx.net>
  3 siblings, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2001-07-06 14:22 UTC (permalink / raw)
  To: Daniel Åkerud <zilch@home.se>; +Cc: PostgreSQL-general <pgsql-general@postgresql.org>

Daniel Åkerud writes:

> Do the BEGIN and END in a function also indicate that it is done in a transaction?

No.

> Or can you put another BEGIN TRANSACTION; END TRANSACTION; in there?

No.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter




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


end of thread, other threads:[~2001-07-06 14:22 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-06 12:40 Transactions within a function Daniel Åkerud <zilch@home.se>
2001-07-06 13:23 ` Jan Wieck <JanWieck@Yahoo.com>
2001-07-06 13:32 ` Doug McNaught <doug@wireboard.com>
2001-07-06 13:47 ` Alex Pilosov <alex@pilosoft.com>
2001-07-06 14:22 ` Peter Eisentraut <peter_e@gmx.net>

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