Fix brin_summarize_new_values() to check index type and ownership.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: e10838026b373f01d1de0f4f7ea80a60c30565da
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-12-26T17:56:09Z
Releases: 9.5.0
Fix brin_summarize_new_values() to check index type and ownership.

brin_summarize_new_values() did not check that the passed OID was for
an index at all, much less that it was a BRIN index, and would fail in
obscure ways if it wasn't (possibly damaging data first?).  It also
lacked any permissions test; by analogy to VACUUM, we should only allow
the table's owner to summarize.

Noted by Jeff Janes, fix by Michael Paquier and me

Files

PathChange+/−
src/backend/access/brin/brin.c modified +39 −3
src/test/regress/expected/brin.out modified +11 −0
src/test/regress/sql/brin.sql modified +5 −0