mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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
This commit is contained in:
@ -407,3 +407,14 @@ FROM tenk1 ORDER BY unique2 LIMIT 5 OFFSET 5;
|
||||
VACUUM brintest; -- force a summarization cycle in brinidx
|
||||
UPDATE brintest SET int8col = int8col * int4col;
|
||||
UPDATE brintest SET textcol = '' WHERE textcol IS NOT NULL;
|
||||
-- Tests for brin_summarize_new_values
|
||||
SELECT brin_summarize_new_values('brintest'); -- error, not an index
|
||||
ERROR: "brintest" is not an index
|
||||
SELECT brin_summarize_new_values('tenk1_unique1'); -- error, not a BRIN index
|
||||
ERROR: "tenk1_unique1" is not a BRIN index
|
||||
SELECT brin_summarize_new_values('brinidx'); -- ok, no change expected
|
||||
brin_summarize_new_values
|
||||
---------------------------
|
||||
0
|
||||
(1 row)
|
||||
|
||||
|
@ -416,3 +416,8 @@ VACUUM brintest; -- force a summarization cycle in brinidx
|
||||
|
||||
UPDATE brintest SET int8col = int8col * int4col;
|
||||
UPDATE brintest SET textcol = '' WHERE textcol IS NOT NULL;
|
||||
|
||||
-- Tests for brin_summarize_new_values
|
||||
SELECT brin_summarize_new_values('brintest'); -- error, not an index
|
||||
SELECT brin_summarize_new_values('tenk1_unique1'); -- error, not a BRIN index
|
||||
SELECT brin_summarize_new_values('brinidx'); -- ok, no change expected
|
||||
|
Reference in New Issue
Block a user