Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIL3v-0002SG-F7 for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Oct 2019 23:08:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIL3u-0007Hs-4E for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Oct 2019 23:08:06 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIL3t-0007Hj-Na for pgsql-bugs@lists.postgresql.org; Wed, 09 Oct 2019 23:08:05 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIL3q-0000Q5-9E for pgsql-bugs@lists.postgresql.org; Wed, 09 Oct 2019 23:08:05 +0000 Received: by mail-wr1-x443.google.com with SMTP id r5so5209501wrm.12 for ; Wed, 09 Oct 2019 16:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kBQH/Jiap0PYRjyGi5kVuHBfaeb7op9t2Yjxs8wFh/k=; b=lumdJ7L7TkB2fB4dzDxKFphrUh8+HH2SfwbtMJW0hha+NUHaBdrND16fjvHMW2stSj 2SYNMvZpoWFweOXgunravfmrxxWXO8aqKLeSTda/3NcNEJkpOWv7cpjKKlQiSjtJg0yl MNJueyQ1ZDrslVDFMcLEBy8IDEGg4PbtVnxM9jVKbRs0c5AzpDuPN34z1SqSkihTQB6L 47Aos2EOBEIbI/bodKsvgG9LJh9RrQvYpFWmaU6iqebdnN2A/NBVikgQgeV5fHXLspxF kJtswXfBy18Wd2kj9pc04Uof4GqWJQr0E3bcXwWT1BgXT8erKQ+wE8+UWLFqSmXi4GYB Scyg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kBQH/Jiap0PYRjyGi5kVuHBfaeb7op9t2Yjxs8wFh/k=; b=TUmEiqDtgM0jPXQc/gexvaDK7cyDf/jMfp4Na5z8B1VG2BqvbrkJcAHPaiwL6ssCho tjM8Eag+82ZWKVozUGnH4DwlY88a8SoZYeIRxbwlKLmq3/GT3bh0KHJVCPQN8emmW3Vo fvZyd75pyKxQG2HQ2Iou8DPEEtXpZ3TRfo3bSZFc89klhKwBbh2LaCwhhXjkFkvnzV6e PJCXv1a2KxtIUH+yTSaywHv9O1ZyWeDDdBNnRN8dJ3yW49x1LuQAIoyeZ6yfZ8reGk60 f6M2Cx4/+5Iux87Ad3wQfs+xniOEdj8gz/gUBMHVxsQG2yeWoDOZhWWKEVQoUiyjPYVO 5spg== X-Gm-Message-State: APjAAAVTB0/G5sCOhDnP+jNQxg3bqJjgg6NlGMm1BZ9kMxo+pqT80vyx yEkfawk7gxTcwaVTDPjKUybmKw== X-Google-Smtp-Source: APXvYqwHcANQ1AMAd+2OFRE41SsbrN7oVjs9EGwlpVYwT8JinRfYoO9zGW6B/00dyvJrx+LNCmmvzw== X-Received: by 2002:a5d:62cd:: with SMTP id o13mr5067712wrv.101.1570662481122; Wed, 09 Oct 2019 16:08:01 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id f3sm4266905wrq.53.2019.10.09.16.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 16:08:00 -0700 (PDT) Date: Thu, 10 Oct 2019 01:07:59 +0200 From: Tomas Vondra To: buschmann@nidsa.net, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16045: vacuum_db crash and illegal memory alloc after pg_upgrade from PG11 to PG12 Message-ID: <20191009230759.ge66neof5qj627a2@development> References: <16045-673e8fa6b5ace196@postgresql.org> <20191009132436.uugh4r3be6vw6ex4@development> <20191009135907.km2b5nrzflcz6xey@development> <20191009141841.my6k44wfiaquj3ks@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191009141841.my6k44wfiaquj3ks@development> User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Well, I think I found the root cause. It's because of 7c15cef86d, which changed the definition of sql_identifier so that it's a domain over name instead of varchar. So we now have this: SELECT typname, typlen FROM pg_type WHERE typname = 'sql_identifier': -[ RECORD 1 ]--+--------------- typname | sql_identifier typlen | -1 instead of this -[ RECORD 1 ]--+--------------- typname | sql_identifier typlen | 64 Unfortunately, that seems very much like a break of on-disk format, and after pg_upgrade any table containing sql_identifier columns is pretty much guaranteed to be badly mangled. For example, the first row from the table used in the original report looks like this on PostgreSQL 11: test=# select ctid, * from q_tbl_archiv limit 1; -[ RECORD 1 ]----+-------------------------- ctid | (0,1) table_name | _pg_foreign_data_wrappers column_name | foreign_data_wrapper_name ordinal_position | 5 col_qualifier | foreign_data_wrapper_name id_column | id_default | while on PostgreSQL 12 after pg_upgrade it looks like this test=# select ctid, table_name, column_name, ordinal_position from q_tbl_archiv limit 1;: -[ RECORD 1 ]----+--------------------------------------------------------- ctid | (0,1) table_name | 5_pg_foreign_data_wrappers5foreign_data_wrapper_name\x05 column_name | _data_wrapper_name ordinal_position | 0 Not sure what to do about this :-( regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services