Re: Auditing extension for PostgreSQL (Take 2)
От | David Steele |
---|---|
Тема | Re: Auditing extension for PostgreSQL (Take 2) |
Дата | |
Msg-id | 551C2F0B.3010305@pgmasters.net обсуждение исходный текст |
Ответ на | Re: Auditing extension for PostgreSQL (Take 2) (David Steele <david@pgmasters.net>) |
Ответы |
Re: Auditing extension for PostgreSQL (Take 2)
|
Список | pgsql-hackers |
Hi Sawada, On 3/25/15 9:24 AM, David Steele wrote: > On 3/25/15 7:46 AM, Sawada Masahiko wrote: >> 2. >> I got ERROR when executing function uses cursor. >> >> 1) create empty table (hoge table) >> 2) create test function as follows. >> >> create function test() returns int as $$ >> declare >> cur1 cursor for select * from hoge; >> tmp int; >> begin >> open cur1; >> fetch cur1 into tmp; >> return tmp; >> end$$ >> language plpgsql ; >> >> 3) execute test function (got ERROR) >> =# select test(); >> LOG: AUDIT: SESSION,6,1,READ,SELECT,,,selecT test(); >> LOG: AUDIT: SESSION,6,2,FUNCTION,EXECUTE,FUNCTION,public.test,selecT test(); >> LOG: AUDIT: SESSION,6,3,READ,SELECT,,,select * from hoge >> CONTEXT: PL/pgSQL function test() line 6 at OPEN >> ERROR: pg_audit stack is already empty >> STATEMENT: selecT test(); >> >> It seems like that the item in stack is already freed by deleting >> pg_audit memory context (in MemoryContextDelete()), >> before calling stack_pop in dropping of top-level Portal. This has been fixed and I have attached a new patch. I've seen this with cursors before where the parent MemoryContext is freed before control is returned to ProcessUtility. I think that's strange behavior but there's not a lot I can do about it. The code I put in to deal with this situation was not quite robust enough so I had to harden it a bit more. Let me know if you see any other issues. Thanks, -- - David Steele david@pgmasters.net
Вложения
В списке pgsql-hackers по дате отправления: