pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Din Adrian <adrian.din@easynet.ro>
To: Bruno Wolff III <bruno@wolff.to>
To: Zac <zaccheob@inwind.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: Help on Procedure running external function
Date: Tue, 05 Jul 2005 15:52:21 -0700
Message-ID: <opstgptjdbawcxfg@adi> (raw)
In-Reply-To: <20050705123948.GB11379@wolff.to>
References: <opsteqmfbkawcxfg@adi>
	<dabb6g$7k9$1@news.hub.org>
	<opstevy1lkawcxfg@adi>
	<dabkio$1alj$1@news.hub.org>
	<opstgfj3k4awcxfg@adi>
	<dads28$289m$1@news.hub.org>
	<20050705123948.GB11379@wolff.to>

I am sorry but:
the table is TEMPORARY ... I don't need to do any lock on it ....
(eventualy I should do a lock on the table where I want to insert the  
documents - the MagMaxNrBon is only a temp table used for storing the max  
document nr for each user's setings in this transaction - I did that temp  
table instead of running always the return_next_number function (the  
problem I postit first) - I run once the function for every user's  
settings - get the max doc free number, store in the temp table, do the  
insert in onother table and next time I get this number and raise by 1  
instead of running again the get_next_number function (because as I said  
-  it give the same max number (the insert into table is not 'visible') ))

...
as I said it's 'solved' ...

thank you,
Adrian Din


On Tue, 5 Jul 2005 07:39:48 -0500, Bruno Wolff III <bruno@wolff.to> wrote:

> On Tue, Jul 05, 2005 at 13:47:24 +0200,
>   Zac <zaccheob@inwind.it> wrote:
>> I think you should use 'FOR UPDATE' clause in your first "select":
>>
>> select into vnrBon maxnrbon+1 from MagMaxNrBon where magazie =
>> dsgroup.magazie_implicita_lansare FOR UPDATE;
>>
>> In this way you lock the rows eventually returned and no one can update
>> them (or select them "for update") until your transaction finished.
>
> That doesn't work because you don't lock rows which aren't in the table
> yet. You need to use a lock table instead.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




view thread (11+ messages)

Message-ID: <opstgptjdbawcxfg@adi>
Permalink:  ../opstgptjdbawcxfg@adi/
Also on:    postgresql.org/message-id/opstgptjdbawcxfg@adi

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: adrian.din@easynet.ro, bruno@wolff.to, zaccheob@inwind.it
  Subject: Re: Help on Procedure running external function
  In-Reply-To: <opstgptjdbawcxfg@adi>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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