mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Remove pg_replication_origin's TOAST table.
A few places that access this catalog don't set up an active snapshot before potentially accessing its TOAST table. However, roname (the replication origin name) is the only varlena column, so this is only a problem if the name requires out-of-line storage. This commit removes its TOAST table to avoid needing to set up a snapshot. It also places a limit on replication origin names so that attempts to set long names will fail with a more user-friendly error. Those chosen limit of 512 bytes should be sufficient to avoid "row is too big" errors independent of BLCKSZ, but it should also be lenient enough for all reasonable use-cases. Bumps catversion. Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Euler Taveira <euler@eulerto.com> Reviewed-by: Nisha Moond <nisha.moond412@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/ZvMSUPOqUU-VNADN%40nathan
This commit is contained in:
@@ -914,3 +914,7 @@ SELECT test_relpath();
|
||||
|
||||
(1 row)
|
||||
|
||||
-- pg_replication_origin.roname limit
|
||||
SELECT pg_replication_origin_create('regress_' || repeat('a', 505));
|
||||
ERROR: replication origin name is too long
|
||||
DETAIL: Replication origin names must be no longer than 512 bytes.
|
||||
|
||||
@@ -42,6 +42,11 @@ WHERE refclassid = 0 OR refobjid = 0 OR
|
||||
-- as user data by pg_upgrade, which would cause failures.
|
||||
-- 3. pg_authid, since its toast table cannot be accessed when it would be
|
||||
-- needed, i.e., during authentication before we've selected a database.
|
||||
-- 4. pg_replication_origin, since we want to be able to access that catalog
|
||||
-- without setting up a snapshot. To make that safe, it needs to not have a
|
||||
-- toast table, since toasted data cannot be fetched without a snapshot. As of
|
||||
-- this writing, its only varlena column is roname, which we limit to 512 bytes
|
||||
-- to avoid needing out-of-line storage.
|
||||
SELECT relname, attname, atttypid::regtype
|
||||
FROM pg_class c JOIN pg_attribute a ON c.oid = attrelid
|
||||
WHERE c.oid < 16384 AND
|
||||
@@ -61,7 +66,8 @@ ORDER BY 1, 2;
|
||||
pg_class | relpartbound | pg_node_tree
|
||||
pg_largeobject | data | bytea
|
||||
pg_largeobject_metadata | lomacl | aclitem[]
|
||||
(10 rows)
|
||||
pg_replication_origin | roname | text
|
||||
(11 rows)
|
||||
|
||||
-- system catalogs without primary keys
|
||||
--
|
||||
|
||||
@@ -411,3 +411,6 @@ CREATE FUNCTION test_relpath()
|
||||
AS :'regresslib'
|
||||
LANGUAGE C;
|
||||
SELECT test_relpath();
|
||||
|
||||
-- pg_replication_origin.roname limit
|
||||
SELECT pg_replication_origin_create('regress_' || repeat('a', 505));
|
||||
|
||||
@@ -45,6 +45,11 @@ WHERE refclassid = 0 OR refobjid = 0 OR
|
||||
-- as user data by pg_upgrade, which would cause failures.
|
||||
-- 3. pg_authid, since its toast table cannot be accessed when it would be
|
||||
-- needed, i.e., during authentication before we've selected a database.
|
||||
-- 4. pg_replication_origin, since we want to be able to access that catalog
|
||||
-- without setting up a snapshot. To make that safe, it needs to not have a
|
||||
-- toast table, since toasted data cannot be fetched without a snapshot. As of
|
||||
-- this writing, its only varlena column is roname, which we limit to 512 bytes
|
||||
-- to avoid needing out-of-line storage.
|
||||
|
||||
SELECT relname, attname, atttypid::regtype
|
||||
FROM pg_class c JOIN pg_attribute a ON c.oid = attrelid
|
||||
|
||||
Reference in New Issue
Block a user