From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | simplify index tuple descriptor initialization |
Date: | 2018-08-27 14:25:28 |
Message-ID: | ed79a5fc-e267-b3e7-2e06-682c85f9dfaf@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Whenever some pg_attribute field is added or changed, a lot of
repetitive changes all over the code are necessary. Here is a small
change to remove one such place.
We have two code paths for initializing the tuple descriptor for a new
index: For a normal index, we copy the tuple descriptor from the table
and reset a number of fields that are not applicable to indexes. For an
expression index, we make a blank tuple descriptor and fill in the
needed fields based on the provided expressions. As pg_attribute has
grown over time, the number of fields that we need to reset in the first
case is now bigger than the number of fields we actually want to copy,
so it's sensible to do it the other way around: Make a blank descriptor
and copy just the fields we need. This also allows more code sharing
between the two branches, and it avoids having to touch this code for
almost every unrelated change to the pg_attribute structure.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-Simplify-index-tuple-descriptor-initialization.patch | text/plain | 4.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-08-27 14:26:42 | Re: has_table_privilege for a table in unprivileged schema causes an error |
Previous Message | Tom Lane | 2018-08-27 14:19:53 | Re: has_table_privilege for a table in unprivileged schema causes an error |