Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0V4G-00050X-7g for pgsql-hackers@arkaria.postgresql.org; Wed, 11 May 2016 14:24:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b0V4F-0006JT-Qc for pgsql-hackers@arkaria.postgresql.org; Wed, 11 May 2016 14:24:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b0V4D-0006Bx-A2 for pgsql-hackers@postgreSQL.org; Wed, 11 May 2016 14:24:49 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1b0V49-0000qH-O0 for pgsql-hackers@postgreSQL.org; Wed, 11 May 2016 14:24:48 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1b0V46-0004jf-KB; Wed, 11 May 2016 10:24:42 -0400 Date: Wed, 11 May 2016 10:24:42 -0400 From: Bruce Momjian To: Peter Eisentraut Cc: Alvaro Herrera , Stephen Frost , Tom Lane , pgsql-hackers@postgreSQL.org Subject: Re: ALTER TABLE lock downgrades have broken pg_upgrade Message-ID: <20160511142442.GL22756@momjian.us> References: <20160503172541.GA31942@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 11, 2016 at 09:40:09AM -0400, Peter Eisentraut wrote: > Not that that would be useless, but note that the value in this case (and > most others) comes from having a candidate object in the database before > upgrade that exercises the particular problem, mostly independent of what > version you upgrade from and to. So far the way to do that is to leave > "junk" in the regression test database, but that's clearly a bit silly. > > I think the way forward is to create a TAP test suite for pg_upgrade that > specifically exercises a lot of scenarios with small purpose-built test > databases. > > Then, the problem of having to compare dump output across versions also goes > away more easily. I do have some small tests like for tablespaces. I am attaching the SQL script, if that is helpful. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + --azLHFNyN32YCQGCU Content-Type: application/x-sql Content-Disposition: attachment; filename="pg_upgrade_test.sql" Content-Transfer-Encoding: quoted-printable -- non-version-specific tests=0A= --\set ON_ERROR_STOP on=0A= =0A= -- TOAST handling=0A= CREATE TABLE toast_test(x TEXT);=0A= INSERT INTO toast_test VALUES (repeat('x', 40000));=0A= CREATE INDEX iix ON toast_test (x);=0A= CLUSTER toast_test USING iix;=20=0A= VACUUM FULL toast_test;=0A= =0A= -- tablespace=0A= CREATE tablespace tt location '/pg_upgrade/tablespace';=0A= CREATE TABLE tablespace_test(x TEXT) tablespace tt;=0A= INSERT INTO tablespace_test VALUES (repeat('x', 40000));=0A= CREATE INDEX aaa ON tablespace_test(x);=0A= =0A= -- test database in different tablespace with table in cluster=20=0A= -- default tablespace=0A= CREATE DATABASE tbltest TABLESPACE tt;=0A= \connect tbltest=0A= CREATE TABLE t1 (x int);=0A= CREATE TABLE t2 (x int) TABLESPACE pg_default;=0A= \connect test=0A= =0A= -- test postgres or template1 in non-default tablespace=0A= ALTER DATABASE postgres SET TABLESPACE tt;=0A= =0A= -- multi-segment=0A= --CREATE TABLE multi_segment_test (x TEXT);=0A= --INSERT INTO multi_segment_test=0A= --SELECT repeat('x', 500) FROM generate_series(1, 2000000);=0A= =0A= -- tests for 8.3 -> 8.4=0A= =0A= -- generate REINDEX command=0A= CREATE TABLE hash_test(x INT);=0A= CREATE INDEX ii ON hash_test USING hash (x);=0A= =0A= -- generate REINDEX command=0A= CREATE TABLE bpchar_test(x CHAR(5));=0A= CREATE INDEX iia ON bpchar_test (x bpchar_pattern_ops);=0A= =0A= -- this is OK because NAME is the first column=0A= CREATE TABLE name_test1(x NAME);=0A= =0A= -- this will prevent the migration because NAME=0A= -- is not the first column=0A= -- create table name_test2(y int, x name);=0A= =0A= CREATE TABLE tsvector_test (x tsvector);=0A= INSERT INTO tsvector_test VALUES ('c bb aaa');=0A= CREATE INDEX wowidx ON tsvector_test USING gin (x);=0A= =0A= CREATE TABLE tsvector_test2 (x tsvector, y tsvector);=0A= INSERT INTO tsvector_test2 VALUES ('c bb aaa', NULL);=0A= CREATE INDEX wowidx2 ON tsvector_test2 USING gin (x);=0A= =0A= CREATE TABLE tsvector_test3 (x tsvector, y tsvector, z tsvector);=0A= INSERT INTO tsvector_test3 VALUES ('c bb aaa', NULL, NULL);=0A= CREATE INDEX wowidx3 ON tsvector_test3 USING gin (x);=0A= =0A= =0A= -- generates error=0A= --CREATE TABLE tsquery_test (x tsquery);=0A= --INSERT INTO tsquery_test VALUES ('c & bb & aaa');=0A= =0A= -- fails on vacuum=0A= --CREATE TYPE footype AS=0A= --(=0A= -- x double precision,=0A= -- y double precision,=0A= -- z double precision=0A= --);=0A= --=0A= --CREATE TABLE breakmigrator=0A= --(=0A= -- id int,=0A= -- foo_a footype=0A= --);=0A= --=0A= --INSERT INTO breakmigrator (id, foo_a)=0A= -- VALUES (1, (1,2,3));=0A= --INSERT INTO breakmigrator (id, foo_a)=0A= -- VALUES (2, (1,2,3));=0A= --INSERT INTO breakmigrator (id, foo_a)=0A= -- VALUES (3, (1,2,3));=0A= =0A= CREATE DATABASE tablespacedb TABLESPACE tt;=0A= \c tablespacedb=0A= CREATE TABLE tbtest (x SERIAL PRIMARY KEY);=0A= INSERT INTO tbtest VALUES (105);=0A= =0A= --CREATE TABLE regtest(x regclass);=0A= =0A= CREATE DATABASE lo;=0A= \c lo=0A= SELECT lo_import('/etc/motd');=0A= \set loid `psql -qt -c 'select loid from pg_largeobject' lo`=0A= CREATE ROLE user1;=0A= CREATE ROLE user2;=0A= -- force user2 to have a different user id on restore=0A= DROP ROLE user1;=0A= GRANT ALL ON LARGE OBJECT :loid TO user2;=0A= REINDEX TABLE pg_largeobject;=0A= =0A= -- prepared transactions=0A= -- max_prepared_transactions must be updated in postgresql.conf=0A= -- BEGIN WORK;=0A= -- PREPARE TRANSACTION '100';=0A= =0A= CREATE LANGUAGE plpythonu;=0A= CREATE OR REPLACE FUNCTION pymax (a integer, b integer) RETURNS integer AS = $$=0A= if a > b:=0A= return a=0A= return b=0A= $$ LANGUAGE plpythonu;=0A= --azLHFNyN32YCQGCU Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --azLHFNyN32YCQGCU--