Re: Help on Procedure running external function

From: Din Adrian <adrian(dot)din(at)easynet(dot)ro>
To: "Bruno Wolff III" <bruno(at)wolff(dot)to>, Zac <zaccheob(at)inwind(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Help on Procedure running external function
Date: 2005-07-05 22:52:21
Message-ID: opstgptjdbawcxfg@adi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)wolff(dot)to> wrote:

> On Tue, Jul 05, 2005 at 13:47:24 +0200,
> Zac <zaccheob(at)inwind(dot)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/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Grant Morgan 2005-07-06 10:01:54 left joins
Previous Message Din Adrian 2005-07-05 22:06:24 Re: Help on Procedure running external function