Re: [subxacts] Aborting a function
От | Rod Taylor |
---|---|
Тема | Re: [subxacts] Aborting a function |
Дата | |
Msg-id | 1089319923.5999.253.camel@jester обсуждение исходный текст |
Ответ на | [subxacts] Aborting a function (Alvaro Herrera <alvherre@dcc.uchile.cl>) |
Ответы |
Re: [subxacts] Aborting a function
|
Список | pgsql-hackers |
> create function crashme2() returns int strict language plpgsql as ' > begin > subbegin; > select foo; -- aborts the transaction > -- did not close the subxact > end;'; I'm not sure I follow. Are you saying that the following code or something similar will never work? create function insertOrUpdateTabX(int, text) returns as ' BEGIN SUBBEGIN; INSERT INTO tab (key, col) VALUES ($1, $2); GET DIAGNOSTICS status = SQLSTATE; IF (status != 000000) THEN -- Got an error, determine what it is SUBABORT; IF (status = 23505) THEN -- This entry already exists. Update the value instead UPDATE tab SET col = $2 WHEREkey = $1; ELSE RAISE EXCEPTION ''Unrecoverable error''; END IF ELSE SUBCOMMIT: END IF; END; ' language plpgsql;
В списке pgsql-hackers по дате отправления: