Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.
Дата
Msg-id 20200608163932.GA30161@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
On 2020-Jun-03, Amit Langote wrote:

> Are you saying that the planner should take into account the state of
> the cursor specified in WHERE CURRENT OF to determine which of the
> tables to scan for the UPDATE?  Note that neither partition pruning
> nor constraint exclusion know that CurrentOfExpr can possibly allow to
> exclude children of the UPDATE target.

I think from a user POV this is pretty obvious.  The user doesn't really
care that there are partitions that were pruned, because obviously
UPDATE WHERE CURRENT OF cannot refer to a tuple in those partitions.

> > I am possibly shooting in dark, but this puzzles me. And it looks like
> > we can cause wrong rows to be updated in non-partition inheritance
> > where the ctids match?
> 
> I don't think that hazard exists, because the table OID is matched
> before the TID.

It sounds like CURRENT OF should somehow inform pruning that the
partition OID is to be matched as well.  I don't know offhand if this is
easily implementable, though.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: pg_upgrade fails with non-standard ACL
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Bump default wal_level to logical