Simplify redability of some tests for toast_tuple_target in strings.sql

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Subject: Simplify redability of some tests for toast_tuple_target in strings.sql
Date: 2019-04-03 06:59:49
Message-ID: 20190403065949.GH3298@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
toast-test-simplify.patch text/x-diff 2.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2019-04-03 07:00:09 Re: COPY FROM WHEN condition
Previous Message Magnus Hagander 2019-04-03 06:49:25 Re: [PATCH v20] GSSAPI encryption support