Re: Simplify redability of some tests for toast_tuple_target in strings.sql

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Simon Riggs <simon(at)2ndQuadrant(dot)com>
Subject: Re: Simplify redability of some tests for toast_tuple_target in strings.sql
Date: 2019-04-03 09:38:57
Message-ID: _J1DJheY3EEFbo1eCfQW9bjDU2Twe_PBeHM_077tRLW8CLkqWJhEOj9UlSCuuhvTBOTfZ0xOrwI-nEx_7FPNHz505NdBEUC6V1vJW-6r3Q8=@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday, April 3, 2019 8:59 AM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> 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?

+1, that's much more readable. Thanks!

cheers ./daniel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Liu, Huailing 2019-04-03 09:55:47 fix memory overflow in ecpg preproc module
Previous Message Magnus Hagander 2019-04-03 09:31:24 Re: Checksum errors in pg_stat_database