This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
amcheck_next is a distinct extension to contrib/amcheck for PostgreSQL extension purposes. It has non-conflicting symbol names. This is preparation for Debian PGDG apt packaging. This establishes the convention that extension version will not be equal to package/release version, in order to ease shipping new versions that only change C code (versions that require no SQL script changes). We now follow the style of postgresql-unit: we use simple integers for SQL extension versions, but traditional mulipart versions for packages. This convention is intended to make it clear that SQL extension version and package version are orthogonal. The first SQL extension version is 1. The package version is 1.0. In passing, Change Debian debian/source/format to "1.0", and remove Travis support. Per feedback from Christoph Berg.
- Loading branch information
1 parent
0b236ae
commit 1a7685a
Showing
25 changed files
with
229 additions
and
329 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# amcheck_next extension | ||
comment = 'verify the logical consistency of indexes' | ||
default_version = '1' | ||
module_pathname = '$libdir/amcheck_next' | ||
relocatable = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# Only support versions with robust approach to B-Tree page deletion and | ||
# concurrent page splits | ||
# | ||
# PostgreSQL 10 is not supported, if only because its contrib extension has a conflicting extension name. | ||
9.4 | ||
9.5 | ||
9.6 | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0 (quilt) | ||
1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
-- minimal test, basically just verifying that amcheck | ||
CREATE TABLE bttest_a(id int8); | ||
CREATE TABLE bttest_b(id int8); | ||
INSERT INTO bttest_a SELECT * FROM generate_series(1, 100000); | ||
INSERT INTO bttest_b SELECT * FROM generate_series(100000, 1, -1); | ||
CREATE INDEX bttest_a_idx ON bttest_a USING btree (id); | ||
CREATE INDEX bttest_b_idx ON bttest_b USING btree (id); | ||
CREATE ROLE bttest_role; | ||
-- verify permissions are checked (error due to function not callable) | ||
SET ROLE bttest_role; | ||
SELECT bt_index_check('bttest_a_idx'::regclass); | ||
ERROR: permission denied for function bt_index_check | ||
SELECT bt_index_parent_check('bttest_a_idx'::regclass); | ||
ERROR: permission denied for function bt_index_parent_check | ||
RESET ROLE; | ||
-- we, intentionally, don't check relation permissions - it's useful | ||
-- to run this cluster-wide with a restricted account, and as tested | ||
-- above explicit permission has to be granted for that. | ||
GRANT EXECUTE ON FUNCTION bt_index_check(regclass) TO bttest_role; | ||
GRANT EXECUTE ON FUNCTION bt_index_parent_check(regclass) TO bttest_role; | ||
SET ROLE bttest_role; | ||
SELECT bt_index_check('bttest_a_idx'); | ||
bt_index_check | ||
---------------- | ||
|
||
(1 row) | ||
|
||
SELECT bt_index_parent_check('bttest_a_idx'); | ||
bt_index_parent_check | ||
----------------------- | ||
|
||
(1 row) | ||
|
||
RESET ROLE; | ||
-- verify plain tables are rejected (error) | ||
SELECT bt_index_check('bttest_a'); | ||
ERROR: "bttest_a" is not an index | ||
SELECT bt_index_parent_check('bttest_a'); | ||
ERROR: "bttest_a" is not an index | ||
-- verify non-existing indexes are rejected (error) | ||
SELECT bt_index_check(17); | ||
ERROR: could not open relation with OID 17 | ||
SELECT bt_index_parent_check(17); | ||
ERROR: could not open relation with OID 17 | ||
-- normal check outside of xact | ||
SELECT bt_index_check('bttest_a_idx'); | ||
bt_index_check | ||
---------------- | ||
|
||
(1 row) | ||
|
||
-- more expansive test | ||
SELECT bt_index_parent_check('bttest_b_idx'); | ||
bt_index_parent_check | ||
----------------------- | ||
|
||
(1 row) | ||
|
||
BEGIN; | ||
SELECT bt_index_check('bttest_a_idx'); | ||
bt_index_check | ||
---------------- | ||
|
||
(1 row) | ||
|
||
SELECT bt_index_parent_check('bttest_b_idx'); | ||
bt_index_parent_check | ||
----------------------- | ||
|
||
(1 row) | ||
|
||
-- make sure we don't have any leftover locks | ||
SELECT * FROM pg_locks | ||
WHERE relation = ANY(ARRAY['bttest_a', 'bttest_a_idx', 'bttest_b', 'bttest_b_idx']::regclass[]) | ||
AND pid = pg_backend_pid(); | ||
locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | fastpath | ||
----------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-----+------+---------+---------- | ||
(0 rows) | ||
|
||
COMMIT; | ||
-- cleanup | ||
DROP TABLE bttest_a; | ||
DROP TABLE bttest_b; | ||
DROP OWNED BY bttest_role; -- permissions | ||
DROP ROLE bttest_role; |
Oops, something went wrong.