pgsql: Fix pg_dump to not emit invalid SQL for an empty operator class.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix pg_dump to not emit invalid SQL for an empty operator class.
Date: 2017-05-26 16:51:24
Message-ID: E1dEISS-0005g8-59@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix pg_dump to not emit invalid SQL for an empty operator class.

If an operator class has no operators or functions, and doesn't need
a STORAGE clause, we emitted "CREATE OPERATOR CLASS ... AS ;" which
is syntactically invalid. Fix by forcing a STORAGE clause to be
emitted anyway in this case.

(At some point we might consider changing the grammar to allow CREATE
OPERATOR CLASS without an opclass_item_list. But probably we'd want to
omit the AS in that case, so that wouldn't fix this pg_dump issue anyway.)

It's been like this all along, so back-patch to all supported branches.

Daniel Gustafsson, tweaked by me to avoid a dangling-pointer bug

Discussion: https://postgr.es/m/D9E5FC64-7A37-4F3D-B946-7E4FB468F88A@yesql.se

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5886c7d5893f88efe5de0bf78d9a1439d09c004a

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-05-26 19:18:45 pgsql: Move autogenerated array types out of the way during ALTER ... R
Previous Message Magnus Hagander 2017-05-26 15:03:22 pgsql: Remove docs mention of PGREALM variable