Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpaVT-0000ZZ-5Z for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Dec 2020 17:22:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpaVS-0000Ya-4Z for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Dec 2020 17:22:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpaVR-0000YP-Hb for pgsql-hackers@lists.postgresql.org; Wed, 16 Dec 2020 17:22:29 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kpaVO-00077z-8Q for pgsql-hackers@lists.postgresql.org; Wed, 16 Dec 2020 17:22:28 +0000 Received: by mail-ot1-x32a.google.com with SMTP id a109so23685274otc.1 for ; Wed, 16 Dec 2020 09:22:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hqTtPAmd+hYrJhhv5W0WDctLOq+fFJ+zvRbi+idbmpY=; b=N48xEejQr62/pQYwfdOoUfdpQBWuTFCocyHhshZI2FlrqHRNLNkUhfAqpJp0xPybRa w5UY2sgqGmL3NtdJp3fFeBnORSgQYegTWUVF7r9fL2VPkBsFqyqJTRy87/kOBMY15qG5 WwMreEnxIWiFPO2ZaDQkDwIlnFikon+FAAAM6U+fKeCpWUaXzFhHnOdC/NK0YVwaYHXc vAXvdNE4AdDnfJoTkvvl1ry0kP5iVTpDYcwdi82BQU75ft9kbkzMq9Csdz8eGNfCr50q f2ANhwxsLokPWNX/hCqOjZsy8ikAMXbD9a3tc0XpDYIJZq2cPdyp5mdnt9OodxuKQCvZ 28IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hqTtPAmd+hYrJhhv5W0WDctLOq+fFJ+zvRbi+idbmpY=; b=FRgfSL51Tf23wKEdoSwRKzRDaPXVQe1uSf6RuHRkVRULAONd6Od+ijVn6RDm28sQib uF/uzLENK4ZIxfeUe4S/5vioMNUPEtVTXVKxEIsTK2Wzm7j6btS7lA4qtuC2lJRc+ctW l+EY/hTRax8vg98EvU0VC5wxw/KYlbpWvTVLTgRtY7gt9uCEGHRzj5PQ5+0kCmVm2nl+ GSAGTtA1dUYjRIpC5cLVta6VvCdQpjvGo0dBDWflZGJAHiCfxNo65/EHBadvikSxoRRq CIR64Pabfw/tRrUyI5peMI7/e41h9t8v0CQR4IE8Dmd748/D9xVtg+KKWeOnsB5vZqMX 6n9Q== X-Gm-Message-State: AOAM530l7Oyd2hWgpQXSn653+V/hp6W92wqS7HyPy+ZmA2h2F3hUme35 vsECZ5W7O+2CCmtfnS1q3DFtUkVFH1va08z6 X-Google-Smtp-Source: ABdhPJyuDo8dT44QMLpb5Ch++85qEpXoL1lTj+/8ucCFZQ6rVNTyjz79fQd7pChmD42NaREJlO7JHQ== X-Received: by 2002:a05:6830:1501:: with SMTP id k1mr27419917otp.12.1608139345174; Wed, 16 Dec 2020 09:22:25 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k3sm617135oor.19.2020.12.16.09.22.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Dec 2020 09:22:24 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 307BD80077E; Wed, 16 Dec 2020 11:22:23 -0600 (CST) Date: Wed, 16 Dec 2020 11:22:23 -0600 From: Justin Pryzby To: Tomas Vondra Cc: Tom Lane , Andres Freund , buschmann@nidsa.net, pgsql-hackers@lists.postgresql.org Subject: Re: pg_upgrade test for binary compatibility of core data types Message-ID: <20201216172222.GS30237@telsasoft.com> References: <20191010204022.6hiiubm2cueu3ghk@development> <20191013001032.lqrn4kqaovhrf77l@development> <17717.1570991208@sss.pgh.pa.us> <20191013203848.2eksimmpux3546wr@development> <27596.1571062600@sss.pgh.pa.us> <20191014163538.cqn6j4cl7s2mk2yz@development> <20191015001817.zei45apgpu5dzngr@development> <20191015044118.GO3599@telsasoft.com> <20191015070725.csmdmdvrlb6klwkg@development> <20201206180248.GI24052@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="h56sxpGKRmy85csR" Content-Disposition: inline In-Reply-To: <20201206180248.GI24052@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --h56sxpGKRmy85csR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Dec 06, 2020 at 12:02:48PM -0600, Justin Pryzby wrote: > I meant to notice if the binary format is accidentally changed again, which was > what happened here: > 7c15cef86 Base information_schema.sql_identifier domain on name, not varchar. > > I added a table to the regression tests so it's processed by pg_upgrade tests, > run like: > > | time make -C src/bin/pg_upgrade check oldsrc=`pwd`/11 oldbindir=`pwd`/11/tmp_install/usr/local/pgsql/bin Per cfbot, this avoids testing ::xml (support for which may not be enabled) And also now tests oid types. I think the per-version hacks should be grouped by logical change, rather than by version. Which I've started doing here. -- Justin --h56sxpGKRmy85csR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-WIP-pg_upgrade-test.sh-changes-needed-to-allow-te.patch" From 6a5bcdf6b3c9244e164455792cec612e317cb8d3 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sat, 5 Dec 2020 22:31:19 -0600 Subject: [PATCH v2 1/3] WIP: pg_upgrade/test.sh: changes needed to allow testing upgrade from v11 --- src/bin/pg_upgrade/test.sh | 92 ++++++++++++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh index 04aa7fd9f5..9733217535 100644 --- a/src/bin/pg_upgrade/test.sh +++ b/src/bin/pg_upgrade/test.sh @@ -23,7 +23,7 @@ standard_initdb() { # To increase coverage of non-standard segment size and group access # without increasing test runtime, run these tests with a custom setting. # Also, specify "-A trust" explicitly to suppress initdb's warning. - "$1" -N --wal-segsize 1 -g -A trust + "$1" -N -A trust if [ -n "$TEMP_CONFIG" -a -r "$TEMP_CONFIG" ] then cat "$TEMP_CONFIG" >> "$PGDATA/postgresql.conf" @@ -108,6 +108,9 @@ export EXTRA_REGRESS_OPTS mkdir "$outputdir" mkdir "$outputdir"/testtablespace +mkdir "$outputdir"/sql +mkdir "$outputdir"/expected + logdir=`pwd`/log rm -rf "$logdir" mkdir "$logdir" @@ -172,16 +175,83 @@ if "$MAKE" -C "$oldsrc" installcheck-parallel; then fix_sql="" case $oldpgversion in 804??) - fix_sql="DROP FUNCTION public.myfunc(integer); DROP FUNCTION public.oldstyle_length(integer, text);" + fix_sql="$fix_sql DROP FUNCTION public.myfunc(integer);" ;; - *) - fix_sql="DROP FUNCTION public.oldstyle_length(integer, text);" + esac + + # Removed in v10 commit 5ded4bd21 + case $oldpgversion in + 804??|9????) + fix_sql="$fix_sql DROP FUNCTION public.oldstyle_length(integer, text);" + ;; + esac + + # commit 068503c76511cdb0080bab689662a20e86b9c845 + case $oldpgversion in + 10????) # XXX + fix_sql="$fix_sql DROP TRANSFORM FOR integer LANGUAGE sql CASCADE;" + ;; + esac + + # commit db3af9feb19f39827e916145f88fa5eca3130cb2 + case $oldpgversion in + 10????) # XXX + fix_sql="$fix_sql DROP FUNCTION boxarea(box);" + fix_sql="$fix_sql DROP FUNCTION funny_dup17();" ;; esac + + # commit cda6a8d01d391eab45c4b3e0043a1b2b31072f5f + case $oldpgversion in + 10????) # XXX + fix_sql="$fix_sql DROP TABLE abstime_tbl;" + fix_sql="$fix_sql DROP TABLE reltime_tbl;" + fix_sql="$fix_sql DROP TABLE tinterval_tbl;" + ;; + esac + + # Various things removed for v14 + case $oldpgversion in + 804??|9????|10????|11????|12????|13????) + # commit 76f412ab3 + # This one is only needed for v11+ ?? + # (see below for more operators removed that also apply to older versions) + fix_sql="$fix_sql DROP OPERATOR public.!=- (pg_catalog.int8, NONE);" + ;; + esac + case $oldpgversion in + 804??|9????|10????|11????|12????|13????) + # commit 76f412ab3 + fix_sql="$fix_sql DROP OPERATOR public.#@# (pg_catalog.int8, NONE);" + fix_sql="$fix_sql DROP OPERATOR public.#%# (pg_catalog.int8, NONE);" + fix_sql="$fix_sql DROP OPERATOR public.#@%# (pg_catalog.int8, NONE);" + + # commit 9e38c2bb5 and 97f73a978 + # fix_sql="$fix_sql DROP AGGREGATE array_larger_accum(anyarray);" + fix_sql="$fix_sql DROP AGGREGATE array_cat_accum(anyarray);" + fix_sql="$fix_sql DROP AGGREGATE first_el_agg_any(anyelement);" + + # commit 76f412ab3 + #fix_sql="$fix_sql DROP OPERATOR @#@(bigint,NONE);" + fix_sql="$fix_sql DROP OPERATOR @#@(NONE,bigint);" + ;; + esac + + # commit 578b22971: OIDS removed in v12 + case $oldpgversion in + 804??|9????|10????|11????) + fix_sql="$fix_sql ALTER TABLE public.tenk1 SET WITHOUT OIDS;" + fix_sql="$fix_sql ALTER TABLE public.tenk1 SET WITHOUT OIDS;" + #fix_sql="$fix_sql ALTER TABLE public.stud_emp SET WITHOUT OIDS;" # inherited + fix_sql="$fix_sql ALTER TABLE public.emp SET WITHOUT OIDS;" + fix_sql="$fix_sql ALTER TABLE public.tt7 SET WITHOUT OIDS;" + ;; + esac + psql -X -d regression -c "$fix_sql;" || psql_fix_sql_status=$? fi - pg_dumpall --no-sync -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? + pg_dumpall --extra-float-digits=0 --no-sync -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? if [ "$newsrc" != "$oldsrc" ]; then # update references to old source tree's regress.so etc @@ -227,23 +297,29 @@ pg_upgrade $PG_UPGRADE_OPTS -d "${PGDATA}.old" -D "$PGDATA" -b "$oldbindir" -p " # Windows hosts don't support Unix-y permissions. case $testhost in MINGW*) ;; - *) if [ `find "$PGDATA" -type f ! -perm 640 | wc -l` -ne 0 ]; then + *) + x=`find "$PGDATA" -type f -perm /127 -ls` + if [ -n "$x" ]; then echo "files in PGDATA with permission != 640"; + echo "$x" |head exit 1; fi ;; esac case $testhost in MINGW*) ;; - *) if [ `find "$PGDATA" -type d ! -perm 750 | wc -l` -ne 0 ]; then + *) + x=`find "$PGDATA" -type d -perm /027 -ls` + if [ "$x" ]; then echo "directories in PGDATA with permission != 750"; + echo "$x" |head exit 1; fi ;; esac pg_ctl start -l "$logdir/postmaster2.log" -o "$POSTMASTER_OPTS" -w -pg_dumpall --no-sync -f "$temp_root"/dump2.sql || pg_dumpall2_status=$? +pg_dumpall --extra-float-digits=0 --no-sync -f "$temp_root"/dump2.sql || pg_dumpall2_status=$? pg_ctl -m fast stop if [ -n "$pg_dumpall2_status" ]; then -- 2.17.0 --h56sxpGKRmy85csR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0002-pg_upgrade-test-to-exercise-binary-compatibility.patch" From 6feef4f0ef4637a2daca7114e7a5c2df687d738d Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sat, 5 Dec 2020 17:20:09 -0600 Subject: [PATCH v2 2/3] pg_upgrade: test to exercise binary compatibility Creating a table with columns of many different datatypes. --- src/test/regress/expected/sanity_check.out | 1 + src/test/regress/expected/type_sanity.out | 38 ++++++++++++++++++++++ src/test/regress/sql/type_sanity.sql | 37 +++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out index 192445878d..aa0a4fd9be 100644 --- a/src/test/regress/expected/sanity_check.out +++ b/src/test/regress/expected/sanity_check.out @@ -69,6 +69,7 @@ line_tbl|f log_table|f lseg_tbl|f main_table|f +manytypes|f mlparted|f mlparted1|f mlparted11|f diff --git a/src/test/regress/expected/type_sanity.out b/src/test/regress/expected/type_sanity.out index 13567ddf84..97cf72bf78 100644 --- a/src/test/regress/expected/type_sanity.out +++ b/src/test/regress/expected/type_sanity.out @@ -660,3 +660,41 @@ WHERE pronargs != 2 ----------+------------+--------- (0 rows) +-- Create a table with different data types, to exercise binary compatibility +-- during pg_upgrade test +CREATE TABLE manytypes AS SELECT +'(11,12)'::point, '(1,1),(2,2)'::line, +'((11,11),(12,12))'::lseg, '((11,11),(13,13))'::box, +'((11,12),(13,13),(14,14))'::path AS openedpath, '[(11,12),(13,13),(14,14)]'::path AS closedpath, +'((11,12),(13,13),(14,14))'::polygon, '1,1,1'::circle, +'today'::date, 'now'::time, 'now'::timestamp, 'now'::timetz, 'now'::timestamptz, '12 seconds'::interval, +'{"reason":"because"}'::json, '{"when":"now"}'::jsonb, '$.a[*] ? (@ > 2)'::jsonpath, +'127.0.0.1'::inet, '127.0.0.0/8'::cidr, '00:01:03:86:1c:ba'::macaddr8, '00:01:03:86:1c:ba'::macaddr, +2::int2, 4::int4, 8::int8, 4::float4, '8'::float8, pi()::numeric, +'c'::bpchar, 'abc'::varchar, 'name'::name, 'txt'::text, true::bool, +E'\\xDEADBEEF'::bytea, B'10001'::bit, B'10001'::varbit AS varbit, '12.34'::money, +'abc'::refcursor, +'1 2'::int2vector, '1 2'::oidvector, format('%s=UC/%s', USER, USER)::aclitem, +'a fat cat sat on a mat and ate a fat rat'::tsvector, 'fat & rat'::tsquery, +'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, '11'::xid8, +'pg_class'::regclass, 'regtype'::regtype type, +'pg_class'::regclass::oid, '(1,1)'::tid, '2'::xid, '3'::cid, +1::information_schema.cardinal_number, +'l'::information_schema.character_data, +'n'::information_schema.sql_identifier, +'now'::information_schema.time_stamp, +'YES'::information_schema.yes_or_no; +-- And now a test on the previous test, checking that all core types are +-- included in this table (or some other non-catalog table processed by pg_upgrade). +SELECT typname, typtype, typelem, typarray, typarray FROM pg_type t +WHERE typnamespace IN ('pg_catalog'::regnamespace, 'information_schema'::regnamespace) +AND typtype IN ('b', 'e', 'd') +-- reg* cannot be pg_upgraded +AND NOT typname~'_|^char$|^reg' +-- XML might be disabled at compile-time +AND oid != ALL(ARRAY['gtsvector', 'xml']::regtype[]) +AND NOT EXISTS (SELECT * FROM pg_attribute a WHERE a.atttypid=t.oid AND a.attnum>0 AND a.attrelid='manytypes'::regclass); + typname | typtype | typelem | typarray | typarray +---------+---------+---------+----------+---------- +(0 rows) + diff --git a/src/test/regress/sql/type_sanity.sql b/src/test/regress/sql/type_sanity.sql index 8c6e614f20..e3012b0888 100644 --- a/src/test/regress/sql/type_sanity.sql +++ b/src/test/regress/sql/type_sanity.sql @@ -489,3 +489,40 @@ FROM pg_range p1 JOIN pg_proc p ON p.oid = p1.rngsubdiff WHERE pronargs != 2 OR proargtypes[0] != rngsubtype OR proargtypes[1] != rngsubtype OR prorettype != 'pg_catalog.float8'::regtype; + +-- Create a table with different data types, to exercise binary compatibility +-- during pg_upgrade test + +CREATE TABLE manytypes AS SELECT +'(11,12)'::point, '(1,1),(2,2)'::line, +'((11,11),(12,12))'::lseg, '((11,11),(13,13))'::box, +'((11,12),(13,13),(14,14))'::path AS openedpath, '[(11,12),(13,13),(14,14)]'::path AS closedpath, +'((11,12),(13,13),(14,14))'::polygon, '1,1,1'::circle, +'today'::date, 'now'::time, 'now'::timestamp, 'now'::timetz, 'now'::timestamptz, '12 seconds'::interval, +'{"reason":"because"}'::json, '{"when":"now"}'::jsonb, '$.a[*] ? (@ > 2)'::jsonpath, +'127.0.0.1'::inet, '127.0.0.0/8'::cidr, '00:01:03:86:1c:ba'::macaddr8, '00:01:03:86:1c:ba'::macaddr, +2::int2, 4::int4, 8::int8, 4::float4, '8'::float8, pi()::numeric, +'c'::bpchar, 'abc'::varchar, 'name'::name, 'txt'::text, true::bool, +E'\\xDEADBEEF'::bytea, B'10001'::bit, B'10001'::varbit AS varbit, '12.34'::money, +'abc'::refcursor, +'1 2'::int2vector, '1 2'::oidvector, format('%s=UC/%s', USER, USER)::aclitem, +'a fat cat sat on a mat and ate a fat rat'::tsvector, 'fat & rat'::tsquery, +'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, '11'::xid8, +'pg_class'::regclass, 'regtype'::regtype type, +'pg_class'::regclass::oid, '(1,1)'::tid, '2'::xid, '3'::cid, +1::information_schema.cardinal_number, +'l'::information_schema.character_data, +'n'::information_schema.sql_identifier, +'now'::information_schema.time_stamp, +'YES'::information_schema.yes_or_no; + +-- And now a test on the previous test, checking that all core types are +-- included in this table (or some other non-catalog table processed by pg_upgrade). +SELECT typname, typtype, typelem, typarray, typarray FROM pg_type t +WHERE typnamespace IN ('pg_catalog'::regnamespace, 'information_schema'::regnamespace) +AND typtype IN ('b', 'e', 'd') +-- reg* cannot be pg_upgraded +AND NOT typname~'_|^char$|^reg' +-- XML might be disabled at compile-time +AND oid != ALL(ARRAY['gtsvector', 'xml']::regtype[]) +AND NOT EXISTS (SELECT * FROM pg_attribute a WHERE a.atttypid=t.oid AND a.attnum>0 AND a.attrelid='manytypes'::regclass); -- 2.17.0 --h56sxpGKRmy85csR--