pgsql: Add missing const qualifier

2022-12-02 Thread David Rowley
Add missing const qualifier This is present in the declaration for ReadDataFromArchive, so we'd better have it in the definition too in order to avoid compilers from complaining about the mismatch of function signatures. Branch -- master Details --- https://git.postgresql.org/pg/commitdi

pgsql: Prevent pgstats from getting confused when relkind of a relation

2022-12-02 Thread Andres Freund
Prevent pgstats from getting confused when relkind of a relation changes When the relkind of a relache entry changes, because a table is converted into a view, pgstats can get confused in 15+, leading to crashes or assertion failures. For HEAD, Tom fixed this in b23cd185fd5, by removing support f

pgsql: Prevent pgstats from getting confused when relkind of a relation

2022-12-02 Thread Andres Freund
Prevent pgstats from getting confused when relkind of a relation changes When the relkind of a relache entry changes, because a table is converted into a view, pgstats can get confused in 15+, leading to crashes or assertion failures. For HEAD, Tom fixed this in b23cd185fd5, by removing support f

pgsql: Prevent pgstats from getting confused when relkind of a relation

2022-12-02 Thread Andres Freund
Prevent pgstats from getting confused when relkind of a relation changes When the relkind of a relache entry changes, because a table is converted into a view, pgstats can get confused in 15+, leading to crashes or assertion failures. For HEAD, Tom fixed this in b23cd185fd5, by removing support f

pgsql: Prevent pgstats from getting confused when relkind of a relation

2022-12-02 Thread Andres Freund
Prevent pgstats from getting confused when relkind of a relation changes When the relkind of a relache entry changes, because a table is converted into a view, pgstats can get confused in 15+, leading to crashes or assertion failures. For HEAD, Tom fixed this in b23cd185fd5, by removing support f

pgsql: Prevent pgstats from getting confused when relkind of a relation

2022-12-02 Thread Andres Freund
Prevent pgstats from getting confused when relkind of a relation changes When the relkind of a relache entry changes, because a table is converted into a view, pgstats can get confused in 15+, leading to crashes or assertion failures. For HEAD, Tom fixed this in b23cd185fd5, by removing support f

pgsql: Prevent pgstats from getting confused when relkind of a relation

2022-12-02 Thread Andres Freund
Prevent pgstats from getting confused when relkind of a relation changes When the relkind of a relache entry changes, because a table is converted into a view, pgstats can get confused in 15+, leading to crashes or assertion failures. For HEAD, Tom fixed this in b23cd185fd5, by removing support f

pgsql: Fix broken hash function hashbpcharextended().

2022-12-02 Thread Jeff Davis
Fix broken hash function hashbpcharextended(). Ignore trailing spaces for non-deterministic collations when hashing. The previous behavior could lead to tuples falling into the wrong partitions when hash partitioning is combined with the BPCHAR type and a non-deterministic collation. Fortunately,

Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

2022-12-02 Thread Jeff Davis
On Fri, 2022-12-02 at 15:26 -0500, Tom Lane wrote: > Perhaps; you got specific wording in mind? Here's what I came up with. It's kind of its own thing, because it can't be described as blank-padded. -- Jeff Davis PostgreSQL Contributor Team - AWS From 3fbe9c3a6acc95d67c468f1406ab816d89c601bb

Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

2022-12-02 Thread Tom Lane
Jeff Davis writes: > BPCHAR is documented as an alias to CHARACTER, but the former can end > up with no typmod at all whereas the latter defaults to CHARACTER(1). > Should we document the case of using BPCHAR with no length? Perhaps; you got specific wording in mind? (I think that that differen

pgsql: Add some error cross-checks to gen_node_support.pl.

2022-12-02 Thread Tom Lane
Add some error cross-checks to gen_node_support.pl. Check that if we generate a call to copy, compare, write, or read a specific node type, that node type does have the appropriate support function. (This doesn't protect against trying to invoke nonexistent code when considering generic field typ

pgsql: Remove gen_node_support.pl's special treatment of EquivalenceCla

2022-12-02 Thread Tom Lane
Remove gen_node_support.pl's special treatment of EquivalenceClasses. It seems better to deal with this by explicit annotations on the fields in question, instead of magic knowledge embedded in the script. While that creates a risk-of-omission from failing to annotate fields, the preceding commit

Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

2022-12-02 Thread Jeff Davis
On Wed, 2022-09-28 at 16:31 +, Tom Lane wrote: > Doc: document bpchar, clarify relationship of text and varchar. BPCHAR is documented as an alias to CHARACTER, but the former can end up with no typmod at all whereas the latter defaults to CHARACTER(1). Should we document the case of using BPC

pgsql: Fix psql's \sf and \ef for new-style SQL functions.

2022-12-02 Thread Tom Lane
Fix psql's \sf and \ef for new-style SQL functions. Some options of these commands need to be able to identify the start of the function body within the output of pg_get_functiondef(). It used to be that that always began with "AS", but since the introduction of new-style SQL functions, it might a

pgsql: Fix psql's \sf and \ef for new-style SQL functions.

2022-12-02 Thread Tom Lane
Fix psql's \sf and \ef for new-style SQL functions. Some options of these commands need to be able to identify the start of the function body within the output of pg_get_functiondef(). It used to be that that always began with "AS", but since the introduction of new-style SQL functions, it might a

pgsql: Fix psql's \sf and \ef for new-style SQL functions.

2022-12-02 Thread Tom Lane
Fix psql's \sf and \ef for new-style SQL functions. Some options of these commands need to be able to identify the start of the function body within the output of pg_get_functiondef(). It used to be that that always began with "AS", but since the introduction of new-style SQL functions, it might a

pgsql: Remove logic for converting a table to a view.

2022-12-02 Thread Tom Lane
Remove logic for converting a table to a view. Up to now we have allowed manual creation of an ON SELECT rule on a table to convert it into a view. That was never anything but a horrid, error-prone hack though. pg_dump used to rely on that behavior to deal with cases involving circular dependenc

pgsql: doc: Avoid writing in first-person form

2022-12-02 Thread Daniel Gustafsson
doc: Avoid writing in first-person form This rewrites the few places where first-person form was used, and replaces with wording more in line with the rest of the documentation. While there, the section on editing PO files is split between what to edit with, and how to edit, as well as add a miss

pgsql: Report incompatible roles in pg_upgrade checking

2022-12-02 Thread Daniel Gustafsson
Report incompatible roles in pg_upgrade checking When checking for roles with a pg_ prefix in <= 9.5 servers, report all found roles in a text file as how other checks are done instead of just reporting that they exist. Rolenames are printed with their Oids to match other reports. Author: Daniel

pgsql: doc: fix type alignment for CREATE TABLE in triggers

2022-12-02 Thread Daniel Gustafsson
doc: fix type alignment for CREATE TABLE in triggers Datatypes in CREATE TABLE statements in the examples were vertically aligned in most cases, a few examples were unaligned with a single space. This makes sure all examples on the same page are consistently aligned. Patch by Laurenz Albe with so

pgsql: Generalize ri_RootToPartitionMap to use for non-partition childr

2022-12-02 Thread Alvaro Herrera
Generalize ri_RootToPartitionMap to use for non-partition children ri_RootToPartitionMap is currently only initialized for tuple routing target partitions, though a future commit will need the ability to use it even for the non-partition child tables, so make adjustments to the decouple it from th