Simplify redability of some tests for toast_tuple_target in strings.sql
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Cc: Simon Riggs <simon@2ndQuadrant.com>
Date: 2019-04-03T06:59:49Z
Lists: pgsql-hackers
Attachments
- toast-test-simplify.patch (text/x-diff) patch
Hi all,
Some tests for toast_tuple_target introduced by c251336 check if a
toast relation is empty or not using that:
+select 0 = pg_relation_size('pg_toast.pg_toast_'||(select oid from
pg_class where relname =
'toasttest'))/current_setting('block_size')::integer as blocks;
This is overcomplicated as there is not need to compile the relation
toast name, and reltoastrelid can be used directly, like that:
SELECT pg_relation_size(reltoastrelid) = 0 AS data_size
FROM pg_class where relname = 'toasttest';
Any objections if I simplify those tests as per the attached?
--
Michael
Commits
-
Improve readability of some tests in strings.sql
- 92c76021aed4 12.0 landed