Re: pgsql: Represent Lists as expansible arrays, not chains of cons-cells.

2019-07-16 Thread Tom Lane
Michael Paquier writes: > On Mon, Jul 15, 2019 at 05:42:09PM +, Tom Lane wrote: >> Represent Lists as expansible arrays, not chains of cons-cells. > crake is complaining on this one as file_textarray_fdw did not get the > call: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&d

pgsql: Redesign the API for list sorting (list_qsort becomes list_sort)

2019-07-16 Thread Tom Lane
Redesign the API for list sorting (list_qsort becomes list_sort). In the wake of commit 1cff1b95a, the obvious way to sort a List is to apply qsort() directly to the array of ListCells. list_qsort was building an intermediate array of pointers-to-ListCells, which we no longer need, but getting ri

pgsql: Clean up some ad-hoc code for sorting and de-duplicating Lists.

2019-07-16 Thread Tom Lane
Clean up some ad-hoc code for sorting and de-duplicating Lists. heap.c and relcache.c contained nearly identical copies of logic to insert OIDs into an OID list while preserving the list's OID ordering (and rejecting duplicates, in one case but not the other). The comments argue that this is fast

Re: pgsql: Represent Lists as expansible arrays, not chains of cons-cells.

2019-07-16 Thread Andrew Dunstan
On 7/16/19 9:24 AM, Tom Lane wrote: > Michael Paquier writes: >> On Mon, Jul 15, 2019 at 05:42:09PM +, Tom Lane wrote: >>> Represent Lists as expansible arrays, not chains of cons-cells. >> crake is complaining on this one as file_textarray_fdw did not get the >> call: >> https://buildfarm.p

pgsql: Remove lappend_cell...() family of List functions.

2019-07-16 Thread Tom Lane
Remove lappend_cell...() family of List functions. It seems worth getting rid of these functions because they require the caller to retain a ListCell pointer into a List that it's modifying, which is a dangerous practice with the new List implementation. (The only other List-modifying function tha

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Fix thinko in construction of old_conpfeqop list.

2019-07-16 Thread Tom Lane
Fix thinko in construction of old_conpfeqop list. This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if th

pgsql: Move some md.c-specific logic from smgr.c to md.c.

2019-07-16 Thread Thomas Munro
Move some md.c-specific logic from smgr.c to md.c. Potential future SMGR implementations may not want to create tablespace directories when creating an SMGR relation. Move that logic to mdcreate(). Move the initialization of md-specific data structures from smgropen() to a new callback mdopen().