Re: BUG #16758: create temporary table with the same name loses defaults, indexes
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marc Boeren <m.boeren@guidance.nl>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2020-12-01T17:07:41Z
Lists: 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
Commits
-
Ensure that expandTableLikeClause() re-examines the same table.
- fb500296dfa6 9.5.25 landed
- f00c4400270f 9.6.21 landed
- d98e27dc6e41 10.16 landed
- 5f9b05ada1bb 12.6 landed
- 28bb8c496691 11.11 landed
- f7f83a55bf60 14.0 landed
- dffc82a5b9d4 13.2 landed