]> granicus.if.org Git - postgresql/commit
Fix pg_dump to not emit invalid SQL for an empty operator class.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 May 2017 16:51:05 +0000 (12:51 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 May 2017 16:51:05 +0000 (12:51 -0400)
commit41c4eb5ec6118559a22d32ef85797558c0b9d3d5
tree27aa47d37f039426f084f2a6d1bcd7d904f8d2ff
parent828db4d2af0e4e4ad028e66fc3063442f5c8a5c8
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
src/bin/pg_dump/pg_dump.c