SEGFAULT in CREATE EXTENSION related pg_init_privs

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: SEGFAULT in CREATE EXTENSION related pg_init_privs
Date: 2016-04-14 08:27:05
Message-ID: CAFj8pRDspAVLrAgd3LEhcO0hXMdveE3P04LCcvp=_2HvfHnT1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I am trying to prepare orafce for PostgreSQL 9.6.

I can successfully compile this extension, but the statement CREATE
EXTENSION fails on segfault

(gdb) bt
#0 heap_deform_tuple (tuple=tuple(at)entry=0x1d87e90,
tupleDesc=tupleDesc(at)entry=0x7f1dab9525b0, values=values(at)entry=0x1d87a28,
isnull=isnull(at)entry=0x1d882d8 "\177\177\177\177\177~\177\177") at
heaptuple.c:881
#1 0x0000000000477eda in heap_modify_tuple (tuple=tuple(at)entry=0x1d87e90,
tupleDesc=0x7f1dab9525b0,
replValues=replValues(at)entry=0x7ffc5e4076b0,
replIsnull=replIsnull(at)entry=0x7ffc5e407690
"",
doReplace=doReplace(at)entry=0x7ffc5e4076a0 "") at heaptuple.c:817
#2 0x0000000000516ddb in recordExtensionInitPriv (objoid=objoid(at)entry=16471,
classoid=classoid(at)entry=1259,
objsubid=objsubid(at)entry=0, new_acl=new_acl(at)entry=0x1d879d0) at
aclchk.c:5305
#3 0x0000000000519550 in recordExtensionInitPriv (new_acl=0x1d879d0,
objsubid=0, classoid=1259, objoid=16471) at aclchk.c:5262
#4 ExecGrant_Relation (istmt=0x7ffc5e407bc0) at aclchk.c:1965
#5 0x000000000051a325 in ExecGrantStmt_oids (istmt=istmt(at)entry=0x7ffc5e407bc0)
at aclchk.c:564
#6 0x000000000051bdff in ExecuteGrantStmt (stmt=stmt(at)entry=0x1b719f8) at
aclchk.c:549
#7 0x00000000006f88f9 in ProcessUtilitySlow
(parsetree=parsetree(at)entry=0x1b719f8,

queryString=queryString(at)entry=0x1ae30d8 "/* contrib/orafce--3.2.sql
*/\n\n-- complain if script is sourced in psql, rather than via CREATE
EXTENSION\n\n\nCREATE FUNCTION pg_catalog.trunc(value date, fmt
text)\nRETURNS date\nAS '$libdir/orafce','ora"...,
context=context(at)entry=PROCESS_UTILITY_QUERY, params=params(at)entry=0x0,
completionTag=completionTag(at)entry=0x0,
dest=0xc7ec40 <donothingDR>) at utility.c:1514
#8 0x00000000006f76bb in standard_ProcessUtility (parsetree=0x1b719f8,
queryString=0x1ae30d8 "/* contrib/orafce--3.2.sql */\n\n-- complain if
script is sourced in psql, rather than via CREATE EXTENSION\n\n\nCREATE
FUNCTION pg_catalog.trunc(value date, fmt text)\nRETURNS date\nAS
'$libdir/orafce','ora"...,
context=PROCESS_UTILITY_QUERY, params=0x0, dest=0xc7ec40 <donothingDR>,
completionTag=0x0) at utility.c:907
#9 0x000000000058ed9d in execute_sql_string (filename=0x1a8b0a8
"/usr/local/pgsql/share/extension/orafce--3.3.sql",
sql=0x1ae30d8 "/* contrib/orafce--3.2.sql */\n\n-- complain if script
is sourced in psql, rather than via CREATE EXTENSION\n\n\nCREATE FUNCTION
pg_catalog.trunc(value date, fmt text)\nRETURNS date\nAS
'$libdir/orafce','ora"...) at extension.c:746
#10 execute_extension_script (extensionOid=extensionOid(at)entry=16385,
control=control(at)entry=0x1a8b7d0,
from_version=from_version(at)entry=0x0, version=version(at)entry=0x1a8b8b8
"3.3", requiredSchemas=requiredSchemas(at)entry=0x0,
schemaName=schemaName(at)entry=0x1a8b7b0 "public", schemaOid=2200) at
extension.c:906
#11 0x000000000058fc72 in CreateExtensionInternal (parents=parents(at)entry=0x0,
stmt=<optimized out>, stmt=<optimized out>)
at extension.c:1498
#12 0x00000000005901d8 in CreateExtension (stmt=stmt(at)entry=0x1a556d0) at
extension.c:1556
#13 0x00000000006f8379 in ProcessUtilitySlow
(parsetree=parsetree(at)entry=0x1a556d0,

queryString=queryString(at)entry=0x1a54c78 "create extension orafce ;",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL,
params=params(at)entry=0x0, completionTag=completionTag(at)entry=0x7ffc5e408890
"", dest=0x1a55a58) at utility.c:1296
#14 0x00000000006f76bb in standard_ProcessUtility (parsetree=0x1a556d0,
queryString=0x1a54c78 "create extension orafce ;",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, dest=0x1a55a58,
completionTag=0x7ffc5e408890 "") at utility.c:907
#15 0x00000000006f4ed4 in PortalRunUtility (portal=0x19f7aa8,
utilityStmt=0x1a556d0, isTopLevel=<optimized out>, dest=0x1a55a58,
completionTag=0x7ffc5e408890 "") at pquery.c:1175
#16 0x00000000006f5aa6 in PortalRunMulti (portal=portal(at)entry=0x19f7aa8,
isTopLevel=isTopLevel(at)entry=1 '\001',
dest=dest(at)entry=0x1a55a58, altdest=altdest(at)entry=0x1a55a58,
completionTag=completionTag(at)entry=0x7ffc5e408890 "") at pquery.c:1306
#17 0x00000000006f66e6 in PortalRun (portal=portal(at)entry=0x19f7aa8,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=1 '\001', dest=dest(at)entry=0x1a55a58,
altdest=altdest(at)entry=0x1a55a58,
completionTag=completionTag(at)entry=0x7ffc5e408890 "") at pquery.c:813
#18 0x00000000006f401b in exec_simple_query (query_string=0x1a54c78 "create
extension orafce ;") at postgres.c:1094
#19 PostgresMain (argc=<optimized out>, argv=argv(at)entry=0x19d9590,
dbname=<optimized out>, username=<optimized out>)
at postgres.c:4059
#20 0x000000000046dbb5 in BackendRun (port=0x19fbc60) at postmaster.c:4258
#21 BackendStartup (port=0x19fbc60) at postmaster.c:3932

This is enforced by sequence of statements REVOKE, GRANT

try to add following lines to hstore--1.3.sql

CREATE VIEW public.dual AS SELECT 'X'::varchar AS dummy;
REVOKE ALL ON public.dual FROM PUBLIC;
GRANT SELECT, REFERENCES ON public.dual TO PUBLIC;

then create extension hstore enforces this error.

When I remove the REVOKE statement - all is working.

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2016-04-14 08:48:42 Re: Support for N synchronous standby servers - take 2
Previous Message Kyotaro HORIGUCHI 2016-04-14 08:25:39 Re: Support for N synchronous standby servers - take 2