From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marc Boeren <m.boeren@guidance.nl>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16758: create temporary table with the same name loses defaults, indexes
Date: Tue, 01 Dec 2020 12:07:41 -0500
Message-ID: <1399710.1606842461@sss.pgh.pa.us> (raw)
In-Reply-To: <B16D4C9A-2E12-4154-A628-CA239E0A3DA5@guidance.nl>
References: <16758-840e84a6cfab276d@postgresql.org>
<1396479.1606838336@sss.pgh.pa.us>
<B16D4C9A-2E12-4154-A628-CA239E0A3DA5@guidance.nl>
[ please keep the mailing list cc'd ]
Marc Boeren <m.boeren@guidance.nl> writes:
>> Without having dug into the code, I bet what is
>> happening is that after creating pg_temp.xx, the LIKE code is looking
>> to see "what indexes exist on table xx?", to which the answer is "none"
>> because it finds pg_temp.xx. We need to nail down the schema in which
>> xx is sought for that step. As a workaround, you could nail down the
>> schema manually:
>>
>> create temporary table xx (like public.xx including DEFAULTS including
>> CONSTRAINTS including INDEXES);
> This workaround works both on the example code, and on my production code.
Thanks for confirming the diagnosis!
> Not sure if it's a bug worth fixing, but perhaps a mention in the documentation?
No, it's definitely a bug IMO. The change in behavior was not
intentional.
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, m.boeren@guidance.nl, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16758: create temporary table with the same name loses defaults, indexes
In-Reply-To: <1399710.1606842461@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