Re: [HACKERS] proposal: schema variables
От | Pavel Stehule |
---|---|
Тема | Re: [HACKERS] proposal: schema variables |
Дата | |
Msg-id | CAFj8pRC3Eq1xGZ9F7LsqXnyh_851EL7ReoZfE0BxJm4GFVMk7w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] proposal: schema variables (Mark Dilger <hornschnorter@gmail.com>) |
Список | pgsql-hackers |
2017-11-01 19:03 GMT+01:00 Mark Dilger <hornschnorter@gmail.com>:
> Comments, notes?
How would variables behave on transaction rollback?
CREATE TEMP VARIABLE myvar;
SET myvar := 1;
BEGIN;
SET myvar := 2;
COMMIT;
BEGIN;
SET myvar := 3;
ROLLBACK;
SELECT myvar;
How would variables behave when modified in a procedure
that aborts rather than returning cleanly?
The result is 3
When you create variable like you did, then there are not any relation between variable content and transactions. Almost every where session - package - schema variables are untransactional. It can be changed, but with negative impact on performance - so I propose relative simply solution - reset to default on rollback, when variables was changed in transaction - but it is not default behave.
Variables are variables like you know from PlpgSQL. But the holder is not the plpgsql function. The holder is a schema in this case. The variable (meta) is permanent. The content of variable is session based untransactional.
Regards
Pavel
mark
В списке pgsql-hackers по дате отправления: