From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: buschmann@nidsa.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16045: vacuum_db crash and illegal memory alloc after pg_upgrade from PG11 to PG12
Date: Thu, 10 Oct 2019 16:14:20 -0400
Message-ID: <1542.1570738460@sss.pgh.pa.us> (raw)
In-Reply-To: <20191010163350.2rtcjtje6tkgilqi@development>
References: <20191009132436.uugh4r3be6vw6ex4@development>
<20191009135907.km2b5nrzflcz6xey@development>
<20191009141841.my6k44wfiaquj3ks@development>
<20191009230759.ge66neof5qj627a2@development>
<19314.1570663125@sss.pgh.pa.us>
<20191009232836.jg77wccqwy5fgs6s@development>
<20265.1570664514@sss.pgh.pa.us>
<20191010014813.3b2btmkakhrskwgd@alap3.anarazel.de>
<20191010134303.bkwjzchjb2w66iro@development>
<30706.1570717152@sss.pgh.pa.us>
<20191010163350.2rtcjtje6tkgilqi@development>
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> On Thu, Oct 10, 2019 at 10:19:12AM -0400, Tom Lane wrote:
>> To identify such domains, I think we'd need something like
>> WHERE attypid IN (recursive-WITH-query), which makes me nervous.
>> We did support those starting with 8.4, which is as far back as
>> pg_upgrade will go, so in theory it should work. But I think we
>> had bugs with such cases in old releases. Do we want to assume
>> that the source server has been updated enough to avoid any such
>> bugs? The expense of such a query might be daunting, too.
> For the query cost, I think we can assume the domain hierarchies are not
> particularly deep (in practice I'd expect just domains directly on the
> sql_identifier type). And I doubt people are using that very widely,
> it's probably more like this report - ad-hoc CTAS, so just a couple of
> items. So I wouldn't expect it to be a huge deal in most cases. But even
> if it takes a second or two, it's a one-time cost.
What I was worried about was the planner possibly trying to apply the
atttypid restriction as a scan qual using a subplan, which might be rather
awful. But it doesn't look like that happens. I get a hash semijoin to
the CTE output, in all branches back to 8.4, on this trial query:
explain
with recursive sqlidoids(toid) as (
select 'information_schema.sql_identifier'::pg_catalog.regtype as toid
union
select oid from pg_catalog.pg_type, sqlidoids
where typtype = 'd' and typbasetype = sqlidoids.toid
)
SELECT n.nspname, c.relname, a.attname
FROM pg_catalog.pg_class c,
pg_catalog.pg_namespace n,
pg_catalog.pg_attribute a
WHERE c.oid = a.attrelid AND
NOT a.attisdropped AND
a.atttypid in (select toid from sqlidoids) AND
c.relkind IN ('r','v','i') and
c.relnamespace = n.oid AND
n.nspname !~ '^pg_temp_' AND
n.nspname !~ '^pg_toast_temp_' AND
n.nspname NOT IN ('pg_catalog', 'information_schema');
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, tomas.vondra@2ndquadrant.com, andres@anarazel.de, 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
In-Reply-To: <1542.1570738460@sss.pgh.pa.us>
* 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