pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and b

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and b

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and b

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and b

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and b

pgsql: Check syscache result in AlterStatistics

2022-01-22 Thread Tomas Vondra
Check syscache result in AlterStatistics The syscache lookup may return NULL even for valid OID, for example due to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary. Without it, it may fail with a segfault. Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER ST

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and b

pgsql: Check syscache result in AlterStatistics

2022-01-22 Thread Tomas Vondra
Check syscache result in AlterStatistics The syscache lookup may return NULL even for valid OID, for example due to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary. Without it, it may fail with a segfault. Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER ST

pgsql: Check syscache result in AlterStatistics

2022-01-22 Thread Tomas Vondra
Check syscache result in AlterStatistics The syscache lookup may return NULL even for valid OID, for example due to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary. Without it, it may fail with a segfault. Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER ST

pgsql: Remove useless inline marker.

2022-01-22 Thread Tom Lane
Remove useless inline marker. Putting "inline" on a function that's not used anywhere in its own file is useless unless the linker is doing global optimization, a method we don't generally enable. Moreover, it draws warnings from some buildfarm members (curculio at least). Looks like this was sl

pgsql: Doc: add cross-references between array_to_string and string_to_

2022-01-22 Thread Tom Lane
Doc: add cross-references between array_to_string and string_to_array. These functions aren't exact inverses, but they're closely related; yet we document them in two different sections. Add cross-ref s to improve that situation. While here, move the strpos and substr entries to re-alphabetize T

pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING

2022-01-22 Thread Tom Lane
Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX. Previously, unless we had to add a NOT NULL constraint to the column, this command resulted in updating only the index's relcache entry. That's problematic when replication behavior is being driven off the existence of a primar

pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING

2022-01-22 Thread Tom Lane
Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX. Previously, unless we had to add a NOT NULL constraint to the column, this command resulted in updating only the index's relcache entry. That's problematic when replication behavior is being driven off the existence of a primar

pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING

2022-01-22 Thread Tom Lane
Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX. Previously, unless we had to add a NOT NULL constraint to the column, this command resulted in updating only the index's relcache entry. That's problematic when replication behavior is being driven off the existence of a primar

pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING

2022-01-22 Thread Tom Lane
Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX. Previously, unless we had to add a NOT NULL constraint to the column, this command resulted in updating only the index's relcache entry. That's problematic when replication behavior is being driven off the existence of a primar

pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING

2022-01-22 Thread Tom Lane
Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX. Previously, unless we had to add a NOT NULL constraint to the column, this command resulted in updating only the index's relcache entry. That's problematic when replication behavior is being driven off the existence of a primar