Re: BUG #15343: Segmentation fault using pg_dump with --exclude-table if table contains identity column

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: abelisto(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15343: Segmentation fault using pg_dump with --exclude-table if table contains identity column
Date: 2018-08-21 00:37:03
Message-ID: CAKJS1f_RzF8s5Osi2ae3fMMnBOv=zZSw51OJ1iPur=07d0Sw-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> To reproduce:
> $ createdb foo
> $ psql foo -c "create table bar(i int generated by default as identity
> primary key);"
> $ pg_dump foo --exclude-table=bar
> Segmentation fault (core dumped)

This crashes during dumpSequence() when the owning_tab's attnames are
accessed. This array is NULL since we didn't populate it in
getTableAttrs due to the table being !interesting.

I think the fix depends exactly on what we want the behaviour to be
here. Should dumpSequence() still dump out a CREATE SEQUENCE
statement for this, or should we just ignore the sequence? I imagine
we should just ignore identity sequences when we're not going to dump
the table that owns them. It looks like that would require a small
modification in getOwnedSeqs(). Otherwise we'd need something like
the attached to still dump out the CREATE SEQUENCE.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
pg_dump_seq_fix.patch application/octet-stream 1.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2018-08-21 01:19:49 Re: BUG #15343: Segmentation fault using pg_dump with --exclude-table if table contains identity column
Previous Message PG Bug reporting form 2018-08-20 19:38:52 BUG #15343: Segmentation fault using pg_dump with --exclude-table if table contains identity column