Re: BUG #16758: create temporary table with the same name loses defaults, indexes - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16758: create temporary table with the same name loses defaults, indexes
Date
Msg-id 1399710.1606842461@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16758: create temporary table with the same name loses defaults, indexes  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16758: create temporary table with the same name loses defaults, indexes
List pgsql-bugs
[ 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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16758: create temporary table with the same name loses defaults, indexes
Next
From: Tom Lane
Date:
Subject: Re: BUG #16754: When using LLVM and parallel queries aborted all session by pg_cancel_backend.