Skip to content
  • Ryuta Kamizono's avatar
    1b68ead8
    Use squiggly heredoc to strip odd indentation in the executed SQL · 1b68ead8
    Ryuta Kamizono authored
    Before:
    
    ```
    LOG:  execute <unnamed>:             SELECT t.oid, t.typname
                        FROM pg_type as t
                        WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool')
    
    LOG:  execute <unnamed>:               SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
                          FROM pg_type as t
                          LEFT JOIN pg_range as r ON oid = rngtypid
                          WHERE
                            t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric')
                            OR t.typtype IN ('r', 'e', 'd')
                            OR t.typinput::varchar = 'array_in'
                            OR t.typelem != 0
    
    LOG:  statement: SHOW TIME ZONE
    LOG:  statement: SELECT 1
    LOG:  execute <unnamed>:               SELECT COUNT(*)
                          FROM pg_class c
                          LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
                          WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view
                          AND c.relname = 'accounts'
                          AND n.nspname = ANY (current_schemas(false))
    ```
    
    After:
    
    ```
    LOG:  execute <unnamed>: SELECT t.oid, t.typname
            FROM pg_type as t
            WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool')
    
    LOG:  execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid
                          WHERE
                            t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric')
                            OR t.typtype IN ('r', 'e', 'd')
                            OR t.typinput::varchar = 'array_in'
                            OR t.typelem != 0
    
    LOG:  statement: SHOW TIME ZONE
    LOG:  statement: SELECT 1
    LOG:  execute <unnamed>: SELECT COUNT(*)
            FROM pg_class c
            LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
            WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view
            AND c.relname = 'accounts'
            AND n.nspname = ANY (current_schemas(false))
    ```
    1b68ead8
    Use squiggly heredoc to strip odd indentation in the executed SQL
    Ryuta Kamizono authored
    Before:
    
    ```
    LOG:  execute <unnamed>:             SELECT t.oid, t.typname
                        FROM pg_type as t
                        WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool')
    
    LOG:  execute <unnamed>:               SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
                          FROM pg_type as t
                          LEFT JOIN pg_range as r ON oid = rngtypid
                          WHERE
                            t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric')
                            OR t.typtype IN ('r', 'e', 'd')
                            OR t.typinput::varchar = 'array_in'
                            OR t.typelem != 0
    
    LOG:  statement: SHOW TIME ZONE
    LOG:  statement: SELECT 1
    LOG:  execute <unnamed>:               SELECT COUNT(*)
                          FROM pg_class c
                          LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
                          WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view
                          AND c.relname = 'accounts'
                          AND n.nspname = ANY (current_schemas(false))
    ```
    
    After:
    
    ```
    LOG:  execute <unnamed>: SELECT t.oid, t.typname
            FROM pg_type as t
            WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool')
    
    LOG:  execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid
                          WHERE
                            t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric')
                            OR t.typtype IN ('r', 'e', 'd')
                            OR t.typinput::varchar = 'array_in'
                            OR t.typelem != 0
    
    LOG:  statement: SHOW TIME ZONE
    LOG:  statement: SELECT 1
    LOG:  execute <unnamed>: SELECT COUNT(*)
            FROM pg_class c
            LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
            WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view
            AND c.relname = 'accounts'
            AND n.nspname = ANY (current_schemas(false))
    ```
Loading