Re: Help on Procedure running external function - Mailing list pgsql-sql

From Din Adrian
Subject Re: Help on Procedure running external function
Date
Msg-id opstgptjdbawcxfg@adi
Whole thread Raw
In response to Re: Help on Procedure running external function  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-sql
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/



pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Help on Procedure running external function
Next
From: Bricklen Anderson
Date:
Subject: Re: Create connection with Oracle database from Postgres plpgsql