pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve correlation names in sanity tests
Date: Mon, 14 Feb 2022 06:29:45 +0000
Message-ID: <E1nJUrp-0003N9-9x@gemulon.postgresql.org> (raw)

Improve correlation names in sanity tests

Some of the queries in the "sanity" tests in the regression test suite
(opr_sanity, type_sanity) are very confusing.  One main stumbling
block is that for some probably ancient reason many of the older
queries are written with correlation names p1, p2, etc. independent of
the name of the catalog. This one is a good example:

SELECT p1.oid, p1.oprname, p2.oid, p2.proname
FROM pg_operator AS p1, pg_proc AS p2          <-- HERE
WHERE p1.oprcode = p2.oid AND
    p1.oprkind = 'l' AND
    (p2.pronargs != 1
     OR NOT binary_coercible(p2.prorettype, p1.oprresult)
     OR NOT binary_coercible(p1.oprright, p2.proargtypes[0])
     OR p1.oprleft != 0);

This is better written as

SELECT o1.oid, o1.oprname, p1.oid, p1.proname
FROM pg_operator AS o1, pg_proc AS p1
WHERE o1.oprcode = p1.oid AND
    o1.oprkind = 'l' AND
    (p1.pronargs != 1
     OR NOT binary_coercible(p1.prorettype, o1.oprresult)
     OR NOT binary_coercible(o1.oprright, p1.proargtypes[0])
     OR o1.oprleft != 0);

This patch cleans up all the queries in this manner.

(As in the above case, I kept the digits like o1 and p1 even in cases
where only one of each letter is used in a query.  This is mainly to
keep the style consistent.)

Discussion: https://www.postgresql.org/message-id/flat/c538308b-319c-8784-e250-1284d12d5411%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9898c5e03c40c133a9a01d8b2b36cb7c990b30d5

Modified Files
--------------
src/test/regress/expected/opr_sanity.out  | 374 ++++++++++++------------
src/test/regress/expected/type_sanity.out | 466 +++++++++++++++---------------
src/test/regress/sql/opr_sanity.sql       | 376 ++++++++++++------------
src/test/regress/sql/type_sanity.sql      | 466 +++++++++++++++---------------
4 files changed, 841 insertions(+), 841 deletions(-)



Message-ID: <E1nJUrp-0003N9-9x@gemulon.postgresql.org>
Permalink:  ../E1nJUrp-0003N9-9x@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nJUrp-0003N9-9x@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: Improve correlation names in sanity tests
  In-Reply-To: <E1nJUrp-0003N9-9x@gemulon.postgresql.org>
  References: <E1nJUrp-0003N9-9x@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox