pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Steele <david@pgmasters.net>
To: Sawada Masahiko <sawada.mshk@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Abhijit Menon-Sen <ams@2ndquadrant.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Auditing extension for PostgreSQL (Take 2)
Date: Mon, 06 Apr 2015 12:35:48 -0400
Message-ID: <5522B5E4.1090206@pgmasters.net> (raw)
In-Reply-To: <CAD21AoDvODLOB4u2u1nMZEXrumyqZqT9A-uefMX=mrAz_CLYuA@mail.gmail.com>
References: <54E005CC.1060605@pgmasters.net>
	<20150217153402.GQ6717@tamriel.snowman.net>
	<54EB4E56.7050102@pgmasters.net>
	<54ECA551.8060306@pgmasters.net>
	<20150323053146.GA1919@toroid.org>
	<55104204.80008@pgmasters.net>
	<CAD21AoBBQXPBiOncyvZdtOfSzr121GyDoARc4jXo2v-JM_45EQ@mail.gmail.com>
	<20150323181724.GG3636@alvh.no-ip.org>
	<CAD21AoA1-UVvjt0q8wvXBRc83RRwDhBgtRTR5vXByPdKb=e6-g@mail.gmail.com>
	<55118509.8020009@pgmasters.net>
	<CAD21AoD+MFYjjTz08gZtyDNQ77kt71ckyKvo7W+QuPq4icMjQA@mail.gmail.com>
	<55122A1E.7030401@pgmasters.net>
	<CAD21AoBFs2sA31Y+zgioQYfiXc0vGEOM3GcgouNc_AH00QCCow@mail.gmail.com>
	<5512B71C.7030808@pgmasters.net>
	<551C2F0B.3010305@pgmasters.net>
	<CAD21AoBJQwwFm_S5TitohbHVbb-TWga4=7uOPofgaj+V6hrsmA@mail.gmail.com>
	<551E8F37.2060202@pgmasters.net>
	<CAD21AoDvODLOB4u2u1nMZEXrumyqZqT9A-uefMX=mrAz_CLYuA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 4/6/15 8:40 AM, Sawada Masahiko wrote:
> On Fri, Apr 3, 2015 at 10:01 PM, David Steele <david@pgmasters.net> wrote:
>> On 4/3/15 3:59 AM, Sawada Masahiko wrote:
>>> On Thu, Apr 2, 2015 at 2:46 AM, David Steele <david@pgmasters.net> wrote:
>>>> Let me know if you see any other issues.
>>>>
>>>
>>> I pulled HEAD, and then tried to compile source code after applied
>>> following "deparsing utility command patch" without #0001 and #0002.
>>> (because these two patches are already pushed)
>>> <http://www.postgresql.org/message-id/20150325175954.GL3636@alvh.no-ip.org;
>>>
>>> But I could not use new pg_audit patch due to compile error (that
>>> deparsing utility command patch might have).
>>> I think I'm missing something, but I'm not sure.
>>> Could you tell me which patch should I apply before compiling pg_audit?
>>
>> When Alvaro posted his last patch set he recommended applying them to
>> b3196e65:
>>
>> http://www.postgresql.org/message-id/20150325175954.GL3636@alvh.no-ip.org
>>
>> Applying the 3/25 deparse patches onto b3196e65 (you'll see one trailing
>> space error) then applying pg_audit-v6.patch works fine.
>>
> 
> I tested v6 patch, but I got SEGV when I executed test() function I
> mentioned up thread.
> Could you address this problem?

Unfortunately I'm not able to reproduce the issue.  Here's what I tried
based on your original test:

postgres=# create table hoge (id int);
CREATE TABLE
postgres=# create function test() returns int as $$
postgres$# declare
postgres$#     cur1 cursor for select * from hoge;
postgres$#     tmp int;
postgres$# begin
postgres$#     open cur1;
postgres$#     fetch cur1 into tmp;
postgres$#    return tmp;
postgres$# end$$
postgres-# language plpgsql ;
CREATE FUNCTION
postgres=# select test();
 test
------

(1 row)
postgres=# insert into hoge values (1);
INSERT 0 1
postgres=# select test();
 test
------
    1
(1 row)

And the log output was:

prefix LOG:  statement: create table hoge (id int);
prefix DEBUG:  EventTriggerInvoke 16385
prefix LOG:  AUDIT: SESSION,3,1,DDL,CREATE
TABLE,TABLE,public.hoge,CREATE  TABLE  public.hoge (id pg_catalog.int4
 )  WITH (oids=OFF)
prefix LOG:  statement: 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 ;
prefix DEBUG:  EventTriggerInvoke 16385
prefix LOG:  AUDIT: SESSION,4,1,DDL,CREATE
FUNCTION,FUNCTION,public.test(),"CREATE  FUNCTION public.test() RETURNS
 pg_catalog.int4 LANGUAGE plpgsql  VOLATILE  CALLED ON NULL INPUT
SECURITY INVOKER COST 100   AS '
	declare
	    cur1 cursor for select * from hoge;
	    tmp int;
	begin
	    open cur1;
	    fetch cur1 into tmp;
	   return tmp;
	end'"
prefix LOG:  statement: select test();
prefix LOG:  AUDIT: SESSION,5,1,READ,SELECT,,,select test();
prefix LOG:  AUDIT:
SESSION,5,2,FUNCTION,EXECUTE,FUNCTION,public.test,select test();
prefix LOG:  AUDIT: SESSION,5,3,READ,SELECT,,,select * from hoge
prefix CONTEXT:  PL/pgSQL function test() line 6 at OPEN
prefix LOG:  statement: insert into hoge values (1);
prefix LOG:  AUDIT: SESSION,6,1,WRITE,INSERT,,,insert into hoge values (1);
prefix LOG:  statement: select test();
prefix LOG:  AUDIT: SESSION,7,1,READ,SELECT,,,select test();
prefix LOG:  AUDIT:
SESSION,7,2,FUNCTION,EXECUTE,FUNCTION,public.test,select test();
prefix LOG:  AUDIT: SESSION,7,3,READ,SELECT,,,select * from hoge
prefix CONTEXT:  PL/pgSQL function test() line 6 at OPEN

Does the above look like what you did?  Any other information about your
environment would also be helpful.  I'm thinking it might be some kind
of build issue.

-- 
- David Steele
david@pgmasters.net

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (65+ messages)  latest in thread

Message-ID: <5522B5E4.1090206@pgmasters.net>
Permalink:  ../5522B5E4.1090206@pgmasters.net/
Also on:    postgresql.org/message-id/5522B5E4.1090206@pgmasters.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: david@pgmasters.net, sawada.mshk@gmail.com, alvherre@2ndquadrant.com, ams@2ndquadrant.com, sfrost@snowman.net, masao.fujii@gmail.com
  Subject: Re: Auditing extension for PostgreSQL (Take 2)
  In-Reply-To: <5522B5E4.1090206@pgmasters.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox