This test exercises the corner case in toast_save_datum() where CLUSTER operations encounter duplicated TOAST references, reusing the existing TOAST data instead of creating redundant copies. During table rewrites like CLUSTER, both live and recently-dead versions of a row may reference the same TOAST value. When copying the second or later version of such a row, the system checks if a TOAST value already exists in the new TOAST table using toastrel_valueid_exists(). If found, toast_save_datum() sets data_todo = 0 so as redundant data is not stored, ensuring only one copy of the TOAST value exists in the new table. The test relies on a combination of UPDATE, CLUSTER, and checks of the TOAST values used before and after the relation rewrite, to make sure that the same values are reused across the rewrite. This is a continuation of 69f75d671475 to make sure that this corner case keeps working should we mess with this area of the code. Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com> Discussion: https://postgr.es/m/CAFAfj_E+kw5P713S8_jZyVgQAGVFfzFiTUJPrgo-TTtJJoazQw@mail.gmail.com
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.