Segfault when creating partition with a primary key and sql_drop trigger exists

From: Marco Slot <marco(at)citusdata(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Onder Kalaci <onder(at)citusdata(dot)com>
Subject: Segfault when creating partition with a primary key and sql_drop trigger exists
Date: 2018-09-20 10:00:18
Message-ID: CANNhMLCpi+HQ7M36uPfGbJZEQLyTy7XvX=5EFkpR-b1bo0uJew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

We're seeing a segmentation fault when creating a partition of a
partitioned table with a primary key when there is a sql_drop trigger on
Postgres 11beta4.

We discovered it because the Citus extension creates a sql_drop trigger,
but it's otherwise unrelated to the Citus extension:
https://github.com/citusdata/citus/issues/2390

To reproduce:

CREATE OR REPLACE FUNCTION on_drop()
RETURNS event_trigger AS $ondrop$
BEGIN
RAISE NOTICE 'drop_trigger';
END;
$ondrop$ LANGUAGE plpgsql;

CREATE EVENT TRIGGER fail_drop_table ON sql_drop
EXECUTE PROCEDURE on_drop();

CREATE TABLE collections_list (
key bigint,
ts timestamptz,
collection_id integer,
value numeric,
PRIMARY KEY(collection_id)
) PARTITION BY LIST ( collection_id );

CREATE TABLE collections_list_1
PARTITION OF collections_list (key, ts, collection_id, value)
FOR VALUES IN (1);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Marco

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ideriha, Takeshi 2018-09-20 10:13:31 RE: Size and size_t in dsa API
Previous Message Thomas Munro 2018-09-20 09:47:07 Re: Size and size_t in dsa API