Skip to content

Commit 4e84256

Browse files
committed
Raise notice 'insufficient privileges', fix pg_constraint_fn inclusion.
1 parent 0137d19 commit 4e84256

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

expected/pathman_permissions.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ BEGIN
1717
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);
1818
EXCEPTION
1919
WHEN insufficient_privilege THEN
20+
RAISE NOTICE 'Insufficient priviliges';
2021
END$$;
22+
NOTICE: Insufficient priviliges
2123
/* Grant SELECT to user2 */
2224
SET ROLE user1;
2325
GRANT SELECT ON permissions.user1_table TO user2;
@@ -28,7 +30,9 @@ BEGIN
2830
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);
2931
EXCEPTION
3032
WHEN insufficient_privilege THEN
33+
RAISE NOTICE 'Insufficient priviliges';
3134
END$$;
35+
NOTICE: Insufficient priviliges
3236
/* Should be ok */
3337
SET ROLE user1;
3438
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);
@@ -71,7 +75,9 @@ BEGIN
7175
INSERT INTO permissions.user1_table (id, a) VALUES (35, 0);
7276
EXCEPTION
7377
WHEN insufficient_privilege THEN
78+
RAISE NOTICE 'Insufficient priviliges';
7479
END$$;
80+
NOTICE: Insufficient priviliges
7581
/* No rights to create partitions (need INSERT privilege) */
7682
SET ROLE user2;
7783
SELECT prepend_range_partition('permissions.user1_table');
@@ -133,7 +139,9 @@ BEGIN
133139
SELECT drop_range_partition('permissions.user1_table_4');
134140
EXCEPTION
135141
WHEN insufficient_privilege THEN
142+
RAISE NOTICE 'Insufficient priviliges';
136143
END$$;
144+
NOTICE: Insufficient priviliges
137145
/* Disable automatic partition creation */
138146
SET ROLE user1;
139147
SELECT set_auto('permissions.user1_table', false);

sql/pathman_permissions.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ BEGIN
2323
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);
2424
EXCEPTION
2525
WHEN insufficient_privilege THEN
26+
RAISE NOTICE 'Insufficient priviliges';
2627
END$$;
2728

2829
/* Grant SELECT to user2 */
@@ -36,6 +37,7 @@ BEGIN
3637
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);
3738
EXCEPTION
3839
WHEN insufficient_privilege THEN
40+
RAISE NOTICE 'Insufficient priviliges';
3941
END$$;
4042

4143
/* Should be ok */
@@ -64,6 +66,7 @@ BEGIN
6466
INSERT INTO permissions.user1_table (id, a) VALUES (35, 0);
6567
EXCEPTION
6668
WHEN insufficient_privilege THEN
69+
RAISE NOTICE 'Insufficient priviliges';
6770
END$$;
6871

6972
/* No rights to create partitions (need INSERT privilege) */
@@ -101,6 +104,7 @@ BEGIN
101104
SELECT drop_range_partition('permissions.user1_table_4');
102105
EXCEPTION
103106
WHEN insufficient_privilege THEN
107+
RAISE NOTICE 'Insufficient priviliges';
104108
END$$;
105109

106110
/* Disable automatic partition creation */

src/relation_info.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
#include "catalog/catalog.h"
2121
#include "catalog/indexing.h"
2222
#include "catalog/pg_constraint.h"
23-
#if PG_VERSION_NUM < 110000 && PG_VERSION_NUM >= 90600
24-
#include "catalog/pg_constraint_fn.h"
25-
#endif
2623
#include "catalog/pg_inherits.h"
2724
#include "catalog/pg_type.h"
2825
#include "miscadmin.h"
@@ -47,8 +44,7 @@
4744
#if PG_VERSION_NUM < 90600
4845
#include "optimizer/planmain.h"
4946
#endif
50-
51-
#if PG_VERSION_NUM >= 90600 && PG_VERSION_NUM < 11000
47+
#if PG_VERSION_NUM < 110000 && PG_VERSION_NUM >= 90600
5248
#include "catalog/pg_constraint_fn.h"
5349
#endif
5450

0 commit comments

Comments
 (0)