Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs
Дата
Msg-id 24188.1549917188@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #15631: Generated as identity field in a temporary table withon commit drop corrupts system catalogs  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> When using `generated by default as identity` in a temporary table with `on
> commit drop`, but without starting a transaction, system catalogs get
> corrupted and won't let create temporary tables anymore.

Interesting.  I can reproduce that (don't need the docker bit...).
The temp table goes away, but the sequence is still there, and so
are its pg_depend entries --- including one saying that it depends
on the table.  That bollixes later attempts to clean out the temp
namespace, since deletion tries to recurse to the missing table.

Even more interesting, it works if you wrap the CREATE in begin/commit.

I don't have time to probe further right now, but I believe what is
wrong is that we're missing a CommandCounterIncrement call after the
sequence is created, or at least after its internal dependency on the
table column is created.  When the transaction commits immediately,
dependency.c fails to see the internal dependency entry and so it
doesn't remove the sequence.  Wrapped in a transaction, there's a
CCI somewhere and all is well.

Peter, will you take this?

            regards, tom lane


В списке pgsql-bugs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #15632: Correctly escaped strings are mishandled in function
Следующее
От: "Saul, Jean Paolo"
Дата:
Сообщение: Re: BUG #15609: synchronous_commit=off insert performance regressionwith secondary indexes