postgresql/src/include/access
Andres Freund f16241bef7 Raise error when affecting tuple moved into different partition.
When an update moves a row between partitions (supported since
2f17844104), our normal logic for following update chains in READ
COMMITTED mode doesn't work anymore. Cross partition updates are
modeled as an delete from the old and insert into the new
partition. No ctid chain exists across partitions, and there's no
convenient space to introduce that link.

Not throwing an error in a partitioned context when one would have
been thrown without partitioning is obviously problematic. This commit
introduces infrastructure to detect when a tuple has been moved, not
just plainly deleted. That allows to throw an error when encountering
a deletion that's actually a move, while attempting to following a
ctid chain.

The row deleted as part of a cross partition update is marked by
pointing it's t_ctid to an invalid block, instead of self as a normal
update would.  That was deemed to be the least invasive and most
future proof way to represent the knowledge, given how few infomask
bits are there to be recycled (there's also some locking issues with
using infomask bits).

External code following ctid chains should be updated to check for
moved tuples. The most likely consequence of not doing so is a missed
error.

Author: Amul Sul, editorialized by me
Reviewed-By: Amit Kapila, Pavan Deolasee, Andres Freund, Robert Haas
Discussion: http://postgr.es/m/CAAJ_b95PkwojoYfz0bzXU8OokcTVGzN6vYGCNVUukeUDrnF3dw@mail.gmail.com
2018-04-07 13:24:27 -07:00
..
amapi.h Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
amvalidate.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
attnum.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_internal.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_page.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_pageops.h Improve FSM management for BRIN indexes. 2018-04-04 14:26:04 -04:00
brin_revmap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_tuple.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_xlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
bufmask.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
clog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
commit_ts.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
genam.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
generic_xlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gin_private.h Predicate locking in GIN index 2018-03-30 14:23:17 +03:00
gin.h Use stdbool.h if suitable 2018-03-22 20:42:25 -04:00
ginblock.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
ginxlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gist_private.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gist.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gistscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gistxlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
hash_xlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
hash.h Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
heapam_xlog.h Raise error when affecting tuple moved into different partition. 2018-04-07 13:24:27 -07:00
heapam.h Raise error when affecting tuple moved into different partition. 2018-04-07 13:24:27 -07:00
hio.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
htup_details.h Raise error when affecting tuple moved into different partition. 2018-04-07 13:24:27 -07:00
htup.h Add FIELDNO_* macro designating offset into structs required for JIT. 2018-03-22 14:45:59 -07:00
itup.h Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
multixact.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nbtree.h Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
nbtxlog.h Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
parallel.h Support parallel btree index builds. 2018-02-02 13:32:44 -05:00
printsimple.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
printtup.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
reloptions.h Allow HOT updates for some expression indexes 2018-03-27 19:57:02 +01:00
relscan.h Support parallel btree index builds. 2018-02-02 13:32:44 -05:00
rewriteheap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rmgrlist.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sdir.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
session.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
skey.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
slru.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spgist_private.h Prevent query-lifespan memory leakage of SP-GiST traversal values. 2018-03-19 23:59:30 -04:00
spgist.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spgxlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
stratnum.h Add prefix operator for TEXT type. 2018-04-03 19:46:45 +03:00
subtrans.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sysattr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
timeline.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
transam.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tsmapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tupconvert.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tupdesc_details.h Fast ALTER TABLE ADD COLUMN with a non-NULL default 2018-03-28 10:43:52 +10:30
tupdesc.h Fast ALTER TABLE ADD COLUMN with a non-NULL default 2018-03-28 10:43:52 +10:30
tupmacs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tuptoaster.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
twophase_rmgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
twophase.h Store 2PC GID in commit/abort WAL recs for logical decoding 2018-03-28 17:42:50 +01:00
valid.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
visibilitymap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xact.h Store 2PC GID in commit/abort WAL recs for logical decoding 2018-03-28 17:42:50 +01:00
xlog_internal.h Allow on-line enabling and disabling of data checksums 2018-04-05 22:04:48 +02:00
xlog.h Allow on-line enabling and disabling of data checksums 2018-04-05 22:04:48 +02:00
xlogdefs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xloginsert.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xlogreader.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xlogrecord.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xlogutils.h Update copyright for 2018 2018-01-02 23:30:12 -05:00