Looks like a 98k file won't get through the list...

-------- Forwarded Message --------
Subject: Core dump with nested CREATE TEMP TABLE
Date: Thu, 27 Aug 2015 19:45:12 -0500
From: Jim Nasby <jim.na...@bluetreble.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>

I don't have an independent reproduction yet (though make test in [1]
should reproduce this). I haven't actually been able to reproduce by
hand yet, but pgtap has something to do with this. This is affecting at
least 9.4 and a fairly recent HEAD.


-- Bits from top of test/sql/base.sql
\i test/helpers/setup.sql

SET ROLE = DEFAULT;
CREATE ROLE test_role;
GRANT USAGE ON SCHEMA tap TO test_role;
GRANT test_role TO test_factory__owner;

CREATE SCHEMA test AUTHORIZATION test_role;
SET ROLE = test_role;
SET search_path = test, tap;
\i test/helpers/create.sql

SELECT tf.register(
   'customer'
   , array[
     row(
       'insert'
       , $$INSERT INTO customer VALUES (DEFAULT, 'first', 'last' )
RETURNING *$$
     )::tf.test_set
     , row(
       'function'
       , $$SELECT * FROM customer__add( 'func first', 'func last' )$$
     )::tf.test_set
   ]
);
SELECT tf.register(
   'invoice'
   , array[
       row(
         'base'
         , $$INSERT INTO invoice VALUES(
             DEFAULT
             , (tf.get( NULL::customer, 'insert' )).customer_id
             , current_date
             , current_date + 30
           ) RETURNING *$$
       )::tf.test_set
   ]
);
SELECT no_plan();
SELECT lives_ok($$SELECT * FROM tf.get( NULL::invoice, 'base' )$$);
not ok 1
# Failed test 1
#         died: 42703: column "c_data_table_name" does not exist


-- Ok, got an error, but no crash. But now...

SELECT results_eq(
   $$SELECT * FROM tf.get( NULL::invoice, 'base' )$$
   , $$VALUES( 1, 1, current_date, current_date + 30 )$$
   , 'invoice factory output'
);
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.

lives_ok() and results_eq() are both pgTap functions. Definitions at [2]
and [3].

I've attached a full server log from running make test, but the most
relevant bit is below:

DEBUG:  AbortSubTransaction
CONTEXT:  PL/pgSQL function results_eq(refcursor,refcursor,text) line 11
during exception cleanup
        PL/pgSQL function results_eq(text,text,text) line 9 at assignment
DEBUG:  name: unnamed; blockState:    INPROGRESS; state: INPROGR,
xid/subid/cid: 1980/1/979, nestlvl: 1, children: 1981 1982 1983 1984
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999
CONTEXT:  PL/pgSQL function results_eq(refcursor,refcursor,text) line 11
during exception cleanup
        PL/pgSQL function results_eq(text,text,text) line 9 at assignment
DEBUG:  name: pg_psql_temporary_savepoint; blockState:  SUB INPROGRS;
state: INPROGR, xid/subid/cid: 2000/34/979, nestlvl: 2, children:
CONTEXT:  PL/pgSQL function results_eq(refcursor,refcursor,text) line 11
during exception cleanup
        PL/pgSQL function results_eq(text,text,text) line 9 at assignment
DEBUG:  name: unnamed; blockState:  SUB INPROGRS; state: INPROGR,
xid/subid/cid: 2001/35/979, nestlvl: 3, children:
CONTEXT:  PL/pgSQL function results_eq(refcursor,refcursor,text) line 11
during exception cleanup
        PL/pgSQL function results_eq(text,text,text) line 9 at assignment
TRAP: FailedAssertion("!(rebuild ? !((bool)((relation)->rd_refcnt == 0))
: ((bool)((relation)->rd_refcnt == 0)))", File: "relcache.c", Line: 2055)

[1] https://github.com/BlueTreble/test_factory/tree/crash
[2] https://github.com/theory/pgtap/blob/master/sql/pgtap.sql.in#L746
[3] https://github.com/theory/pgtap/blob/master/sql/pgtap.sql.in#L6541
which is being called by
https://github.com/theory/pgtap/blob/master/sql/pgtap.sql.in#L6591
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com





--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to