Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1548c3a

Browse files
committed
Remove direct handling of reloptions for toast tables
It doesn't actually work, even with allow_system_table_mods turned on:the ALTER TABLE operation is rejected by ATSimplePermissions(), so eventhe error message we're adding in this commit is unreachable.Add a test case for it.Author: Nikolay Shaplov <dhyan@nataraj.su>Discussion:https://postgr.es/m/1913854.tdWV9SEqCh@thinkpad-pgpro
1 parent92fc685 commit1548c3a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15963,7 +15963,6 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1596315963
switch (rel->rd_rel->relkind)
1596415964
{
1596515965
case RELKIND_RELATION:
15966-
case RELKIND_TOASTVALUE:
1596715966
case RELKIND_MATVIEW:
1596815967
(void) heap_reloptions(rel->rd_rel->relkind, newOptions, true);
1596915968
break;
@@ -15977,6 +15976,8 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1597715976
case RELKIND_PARTITIONED_INDEX:
1597815977
(void) index_reloptions(rel->rd_indam->amoptions, newOptions, true);
1597915978
break;
15979+
case RELKIND_TOASTVALUE:
15980+
/* fall through to error -- shouldn't ever get here */
1598015981
default:
1598115982
ereport(ERROR,
1598215983
(errcode(ERRCODE_WRONG_OBJECT_TYPE),

‎src/test/modules/unsafe_tests/expected/alter_system_table.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ ERROR: permission denied: "pg_description" is a system catalog
9191
SET allow_system_table_mods TO on;
9292
DROP RULE r2 ON pg_description;
9393
RESET allow_system_table_mods;
94+
-- Reloptions on TOAST tables
95+
ALTER TABLE pg_toast.pg_toast_2615 SET (fillfactor = '90');
96+
ERROR: permission denied: "pg_toast_2615" is a system catalog
9497
SET allow_system_table_mods = on;
9598
-- create new table in pg_catalog
9699
BEGIN;
@@ -173,6 +176,10 @@ DROP TRIGGER t2 ON pg_description;
173176
CREATE RULE r1 AS ON INSERT TO pg_description DO INSTEAD NOTHING;
174177
ALTER RULE r1 ON pg_description RENAME TO r2;
175178
DROP RULE r2 ON pg_description;
179+
-- Reloptions on TOAST tables
180+
ALTER TABLE pg_toast.pg_toast_2615 SET (fillfactor = '90');
181+
ERROR: ALTER action SET cannot be performed on relation "pg_toast_2615"
182+
DETAIL: This operation is not supported for TOAST tables.
176183
-- cleanup
177184
REVOKE ALL ON pg_description FROM regress_user_ast;
178185
DROP USER regress_user_ast;

‎src/test/modules/unsafe_tests/sql/alter_system_table.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ SET allow_system_table_mods TO on;
8989
DROPRULE r2ON pg_description;
9090
RESET allow_system_table_mods;
9191

92+
-- Reloptions on TOAST tables
93+
ALTERTABLEpg_toast.pg_toast_2615SET (fillfactor='90');
9294

9395
SET allow_system_table_mods=on;
9496

@@ -187,6 +189,8 @@ CREATE RULE r1 AS ON INSERT TO pg_description DO INSTEAD NOTHING;
187189
ALTERRULE r1ON pg_description RENAME TO r2;
188190
DROPRULE r2ON pg_description;
189191

192+
-- Reloptions on TOAST tables
193+
ALTERTABLEpg_toast.pg_toast_2615SET (fillfactor='90');
190194

191195
-- cleanup
192196
REVOKE ALLON pg_descriptionFROM regress_user_ast;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp