Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YfA0H-0006Ni-54 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2015 16:36:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YfA0G-0002g8-5g for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2015 16:36:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YfA0F-0002fq-8e for pgsql-hackers@postgresql.org; Mon, 06 Apr 2015 16:35:59 +0000 Received: from linode.thelabyrinth.net ([198.58.117.137] helo=mail.thelabyrinth.net) by magus.postgresql.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YfA0A-0006Ft-70 for pgsql-hackers@postgresql.org; Mon, 06 Apr 2015 16:35:58 +0000 Received: from theseus.local (unknown [98.204.177.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 312D6138CF; Mon, 6 Apr 2015 16:35:50 +0000 (UTC) Message-ID: <5522B5E4.1090206@pgmasters.net> Date: Mon, 06 Apr 2015 12:35:48 -0400 From: David Steele User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Sawada Masahiko CC: Alvaro Herrera , Abhijit Menon-Sen , Stephen Frost , Fujii Masao , PostgreSQL-development Subject: Re: Auditing extension for PostgreSQL (Take 2) 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> <20150323181724.GG3636@alvh.no-ip.org> <55118509.8020009@pgmasters.net> <55122A1E.7030401@pgmasters.net> <5512B71C.7030808@pgmasters.net> <551C2F0B.3010305@pgmasters.net> <551E8F37.2060202@pgmasters.net> In-Reply-To: OpenPGP: id=2624538721DAF9D5FDF4952A9FCDF424A2739CF3 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kRS21lB9UcDvClnWXB3ggl4uxHU9EWWkL" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kRS21lB9UcDvClnWXB3ggl4uxHU9EWWkL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/6/15 8:40 AM, Sawada Masahiko wrote: > On Fri, Apr 3, 2015 at 10:01 PM, David Steele wro= te: >> On 4/3/15 3:59 AM, Sawada Masahiko wrote: >>> On Thu, Apr 2, 2015 at 2:46 AM, David Steele wr= ote: >>>> 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) >>> >>> >>> 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_audi= t? >> >> 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 traili= ng >> space error) then applying pg_audit-v6.patch works fine. >> >=20 > 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=3D# create table hoge (id int); CREATE TABLE postgres=3D# 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=3D# select test(); test ------ (1 row) postgres=3D# insert into hoge values (1); INSERT 0 1 postgres=3D# 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=3DOFF) 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. --=20 - David Steele david@pgmasters.net --kRS21lB9UcDvClnWXB3ggl4uxHU9EWWkL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVIrXkAAoJEIA2uIJQ5SFA6ekP/1sJA39n9RTHxcJld88ZSaf9 Qwr2aAtlCdgVakPV95ch0rfuWc6gszvzZix7d05ElgHWdNTVbHyQL/etUTCsa11E xWOi64+piJlvh9MRjzOuxRR3bakUMqyKfERc/dSL20ipIruqM371THXnC3uslUNH GjcZC8KUuaBn3Sw8BNVOSMJugdbHH5e8k1X3iD+xi2rP9Txzni+A1ogE0IHVpciK m+6NvqDP0PlrNc7C7hwzACAwKqf0OlNybpMa5MdNex2BTzX3BZaIjMqSO1tmL20r NB0tYfgC67KWobUsr7bvx7tyfl9KTU1iRap4wb2qDQI5JqE9DkBVZuNagJvWPHOY 03kPh90M2oVC+p/xc2uKzzi8GrwJbsHMvO2DxwYQT+rXRxXRAEI0v2Q7Hx+j61ZV E/PcU/2p/7/1ydT0eKbIPaFelyc2xoYPhQtY0X5S6T7uTbwvmf2w4ipNucFTEBGy cg1DdFON4pXQ37VLbWchKNX4L8Oq3K4HYN1h7n+ddQ9/q+8tEhdpPHc0zpj8VoA7 2HCkntLCzy1d4fkdVCINSEcxhnhELAjSVxLnn0NqD9uHenisotVw27vSFaL6nv5R gxFlG7jN2bQs4r+l+iCfmXx0nKCerEznQYaQEVldMs5glUbXs99/eg8b+0HWTnay N/SudfEEngEBinCNZQ2N =dADy -----END PGP SIGNATURE----- --kRS21lB9UcDvClnWXB3ggl4uxHU9EWWkL--