Re: Using CTID system column as a "temporary" primary key

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Using CTID system column as a "temporary" primary key
Дата
Msg-id be2240923b8017b0c03f980772cdd6ef0678200a.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: Using CTID system column as a "temporary" primary key  (Kirk Wolak <wolakk@gmail.com>)
Ответы Re: Using CTID system column as a "temporary" primary key  (Sebastien Flaesch <sebastien.flaesch@4js.com>)
Список pgsql-general
On Tue, 2023-03-28 at 14:24 -0400, Kirk Wolak wrote:
>
> I cringe at the thought of using CTID.  And while it's probably "safe enough"
> inside a single transaction.  I doubt that there is much "testing" of this concept. 

It is safe to assume that the CTID is stable within a single transaction
only if you use REPEATABLE READ or better transaction isolation level.

With READ COMMITTED, you see updated rows (and consequently changed CTID)
within a single transaction.  And if you use SELECT ... FOR UPDATE, you
could even see a changed CTID within a single statement.

So don't use CTID to identify rows unless you use REPEATABLE READ or better.

Yours,
Laurenz Albe



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: How are the SELECT queries reconstructed in pg_views
Следующее
От: basti
Дата:
Сообщение: Move from MySQL to PostgreSQL