Thread

Commits

  1. Improve readability of some tests in strings.sql

  1. Simplify redability of some tests for toast_tuple_target in strings.sql

    Michael Paquier <michael@paquier.xyz> — 2019-04-03T06:59:49Z

    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
    
  2. Re: Simplify redability of some tests for toast_tuple_target in strings.sql

    Daniel Gustafsson <daniel@yesql.se> — 2019-04-03T09:38:57Z

    On Wednesday, April 3, 2019 8:59 AM, Michael Paquier <michael@paquier.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
    
    
    
    
  3. Re: Simplify redability of some tests for toast_tuple_target in strings.sql

    Michael Paquier <michael@paquier.xyz> — 2019-04-04T01:26:50Z

    On Wed, Apr 03, 2019 at 09:38:57AM +0000, Daniel Gustafsson wrote:
    > +1, that's much more readable. Thanks!
    
    Thanks for the lookup, done.
    --
    Michael