postgresql/src/backend
Michael Paquier 2dd7782217 pageinspect: Fix gist_page_items() with included columns
Non-leaf pages of GiST indexes contain key attributes, leaf pages
contain both key and non-key attributes, and gist_page_items() ignored
the handling of non-key attributes.  This caused a few problems when
using gist_page_items() on a GiST index with INCLUDE:
- On a non-leaf page, the function would crash.
- On a leaf page, the function would work, but miss to display all the
values for included attributes.

This commit fixes gist_page_items() to handle such cases in a more
appropriate way, and now displays the values of key and non-key
attributes for each item separately in a style consistent with what
ruleutils.c would generate for the attribute list, depending on the page
type dealt with.  In a way similar to how a record is displayed, values
would be double-quoted for key or non-key attributes if required.

ruleutils.c did not provide a routine able to control if non-key
attributes should be displayed, so an extended() routine for index
definitions is added to work around the leaf and non-leaf page
differences.

While on it, this commit fixes a third problem related to the amount of
data reported for key attributes.  The code originally relied on
BuildIndexValueDescription() (used for error reports on constraints)
that would not print all the data stored in the index but the index
opclass's input type, so this limited the amount of information
available.  This switch makes gist_page_items() much cheaper as there is
no need to run ACL checks for each item printed, which is not an issue
anyway as superuser rights are required to execute the functions of
pageinspect.  Opclasses whose data cannot be displayed can rely on
gist_page_items_bytea().

The documentation of this function was slightly incorrect for the
output results generated on HEAD and v15, so adjust it on these
branches.

Author: Alexander Lakhin, Michael Paquier
Discussion: https://postgr.es/m/17884-cb8c326522977acb@postgresql.org
Backpatch-through: 14
2023-05-19 12:38:15 +09:00
..
access Fix handling of empty ranges and NULLs in BRIN 2023-05-19 00:15:13 +02:00
backup In basebackup.c, perform end-of-file test after checksum validation. 2023-03-06 10:20:17 -05:00
bootstrap Process session_preload_libraries within InitPostgres's transaction. 2022-07-25 10:27:43 -04:00
catalog Replace last PushOverrideSearchPath() call with set_config_option(). 2023-05-08 06:14:11 -07:00
commands Replace last PushOverrideSearchPath() call with set_config_option(). 2023-05-08 06:14:11 -07:00
executor Mark internal messages as no longer translatable 2023-05-16 11:47:25 +02:00
foreign Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:40 +09:00
jit Fix typos in comments, code and documentation 2023-01-03 16:26:27 +09:00
lib Fix lock assertions in dshash.c. 2022-07-11 16:01:22 +12:00
libpq Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates 2023-02-15 10:12:31 +09:00
main Fix outdated --help message for postgres -f 2022-08-15 13:37:32 +09:00
nodes Fix list_copy_head() with empty Lists 2023-04-21 10:02:25 +12:00
optimizer Handle RLS dependencies in inlined set-returning functions properly. 2023-05-08 10:12:44 -04:00
parser Fix publication syntax error message 2023-05-10 18:26:10 +02:00
partitioning Fix incorrect partition pruning logic for boolean partitioned tables 2023-04-14 16:21:07 +12:00
po Translation updates 2023-05-08 14:29:57 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster Fix vacuum_cost_delay check for balance calculation. 2023-04-25 13:54:10 +02:00
regex Avoid character classification in regex escape parsing. 2023-04-21 08:20:17 -07:00
replication Don't repeatedly register cache callbacks in pgoutput plugin. 2023-02-23 15:40:28 -05:00
rewrite Fix more bugs caused by adding columns to the end of a view. 2023-03-07 18:21:53 -05:00
snowball In the Snowball dictionary, don't try to stem excessively-long words. 2022-08-31 10:42:05 -04:00
statistics Remove unnecessary code in dependency_is_compatible_expression(). 2023-03-14 11:10:45 -04:00
storage Fix typo with wait event for SLRU buffer of commit timestamps 2023-05-05 21:25:50 +09:00
tcop Rethink handling of [Prevent|Is]InTransactionBlock in pipeline mode. 2022-12-13 14:23:59 -05:00
tsearch Fix ts_headline() edge cases for empty query and empty search text. 2023-04-06 15:52:37 -04:00
utils pageinspect: Fix gist_page_items() with included columns 2023-05-19 12:38:15 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Move basebackup code to new directory src/backend/backup 2022-08-10 14:03:09 -04:00
nls.mk Translation updates 2022-11-07 14:04:05 +01:00