Help on Procedure running external function

Поиск
Список
Период
Сортировка
От Din Adrian
Тема Help on Procedure running external function
Дата
Msg-id opsteqmfbkawcxfg@adi
обсуждение исходный текст
Ответы Re: Help on Procedure running external function  (Zac <zaccheob@inwind.it>)
Список pgsql-sql
Hello,
I have a 'big' problem:
I am trying to run from a procedure a function witch generate a new  
document number (max from table +1 ) and after to insert a document with  
this number, but the function returns me the same number each time because  
the tranzaction is not finished and the inserts are not commited and of  
course the next document number is the same.
...

for ...
loop
nr=get_me_next_number(params);
insert into table values (nr,...)
end loop
...

...
error inserting in table .. primary_key nr .....

Is any way in making the external function to 'know' that I inserted  
another row but this insert is in a tranzaction that is not finish yet ?  
ar onother solution ?

for now I 'solved'  by asking for a nr once and generate myself next  
number (+1) but this is not a correct solution (in this time somebody else  
could insert a document with the same nr as the procedure  )

thank you,
Adi


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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: [despammed] Re: 'show full processlist' in postgres?
Следующее
От: Josep Sanmartí
Дата:
Сообщение: select values from interval