postgres/contrib/pageinspect
Tom Lane 370b28ccd4 Fix tuple_data_split() to not open a relation without any lock.
contrib/pageinspect's tuple_data_split() function thought it could get
away with opening the referenced relation with NoLock.  In practice
there's no guarantee that the current session holds any lock on that
rel (even if we just read a page from it), so that this is unsafe.

Switch to using AccessShareLock.  Also, postpone closing the relation,
so that we needn't copy its tupdesc.  Also, fix unsafe use of
att_isnull() for attributes past the end of the tuple.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

Discussion: https://postgr.es/m/2038.1538335244@sss.pgh.pa.us
2018-10-01 11:51:07 -04:00
..
expected Fix new test case to not be endian-dependent. 2018-01-04 15:59:30 -05:00
sql Fix new test case to not be endian-dependent. 2018-01-04 15:59:30 -05:00
.gitignore pageinspect: Add tests 2016-11-01 14:02:16 -04:00
brinfuncs.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
btreefuncs.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
fsmfuncs.c In pageinspect/hashfuncs.c, avoid crashes on alignment-picky machines. 2017-02-03 11:34:47 -05:00
ginfuncs.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
hashfuncs.c pageinspect: Fix use of wrong memory context by hash_page_items. 2018-01-26 09:59:14 -05:00
heapfuncs.c Fix tuple_data_split() to not open a relation without any lock. 2018-10-01 11:51:07 -04:00
Makefile pageinspect: Support hash indexes. 2017-02-02 14:19:32 -05:00
pageinspect--1.1--1.2.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pageinspect--1.2--1.3.sql pageinspect/BRIN: minor tweaks 2014-12-02 12:20:50 -03:00
pageinspect--1.3--1.4.sql Add forgotten file in commit d6061f83a1 2015-11-25 16:59:07 +03:00
pageinspect--1.4--1.5.sql Update pageinspect extension for parallel query. 2016-06-09 17:18:09 -04:00
pageinspect--1.5--1.6.sql pageinspect: Add bt_page_items function with bytea argument 2017-04-04 23:52:55 -04:00
pageinspect--1.5.sql Update pageinspect extension for parallel query. 2016-06-09 17:18:09 -04:00
pageinspect--1.0--1.1.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pageinspect--unpackaged--1.0.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
pageinspect.control pageinspect: Support hash indexes. 2017-02-02 14:19:32 -05:00
pageinspect.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rawpage.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00