Re: Transaction Question

From: Richard Huxton <dev(at)archonet(dot)com>
To: johnsw(at)wardbrook(dot)com
Cc: johnsw(at)wardbrook(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Transaction Question
Date: 2003-12-03 17:52:32
Message-ID: 200312031752.32175.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wednesday 03 December 2003 13:34, John Sidney-Woollett wrote:
> Richard
>
> You summized correctly. The field being updated is basically a sequence
> per volume. BUT the sequences cannot be shared across the volumes...

Why not? Are you worried about running out of numbers, or is there some other
reason?

> I did wonder about "binding" one sequence object to each Volume record, and
> modifying the function so that the identified the volume to use, and then
> obtained the next value from the appropriate sequence object. Is it
> possible to do the following:
>
> --declare var to "hold" the sequence name
> vVolSeqName := "SEQ_VOLUME_1";
>
> --access the sequence from the name in the variable
> select nextval(vVolSeqName) into vFileSeq;

If nothing else, you could use EXECUTE and build your select in a string. See
the manual for details of EXECUTE.

> If I cannot do this, can you suggest a solution to my original bottleneck
> issue. And also the problem of the sequencing number being rolled back in
> the event that the CreateFile function aborts or is rolled back.

A sequence number will never be rolled back. The sequence generator guarantees

> However, for me a bigger area of confusion is how to deal with concurrency
> issues in Postgres generally. Are there any good docs with examples of
> different scenarios?

Not as far as I know (if you would like to contribute some as you learn, I'm
sure it would be appreciated). The isolation levels are listed with the
corresponding standard SQL though, so it might be worth googling for a
general reference.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Murtagh 2003-12-03 18:06:58 Re: Good open source mailing list system PHP / Postgresql
Previous Message Richard Huxton 2003-12-03 17:49:02 Re: Accessing fields in RECORD data type using variables as field names

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-12-03 18:17:17 Re: postgresql-7.4 make error: tuptoaster.c: In function `toast_delete_datum'
Previous Message Anand, VJ (MED, GEMS-IT) 2003-12-03 16:18:52 BTree index and optimizer