pgsql: Speed up tail processing when hashing aligned C strings

2024-03-30 Thread John Naylor
Speed up tail processing when hashing aligned C strings After encountering the NUL terminator, the word-at-a-time loop exits and we must hash the remaining bytes. Previously we calculated the terminator's position and re-loaded the remaining bytes from the input string. We already have all the

pgsql: Custom reloptions for table AM

2024-03-30 Thread Alexander Korotkov
Custom reloptions for table AM Let table AM define custom reloptions for its tables. This allows to specify AM-specific parameters by WITH clause when creating a table. The code may use some parts from prior work by Hao Wu. Discussion:

pgsql: Generalize relation analyze in table AM interface

2024-03-30 Thread Alexander Korotkov
Generalize relation analyze in table AM interface Currently, there is just one algorithm for sampling tuples from a table written in acquire_sample_rows(). Custom table AM can just redefine the way to get the next block/tuple by implementing scan_analyze_next_block() and

pgsql: Let table AM insertion methods control index insertion

2024-03-30 Thread Alexander Korotkov
Let table AM insertion methods control index insertion Previously, the executor did index insert unconditionally after calling table AM interface methods tuple_insert() and multi_insert(). This commit introduces the new parameter insert_indexes for these two methods. Setting '*insert_indexes'

pgsql: Add pg_basetype() function to extract a domain's base type.

2024-03-30 Thread Tom Lane
Add pg_basetype() function to extract a domain's base type. This SQL-callable function behaves much like our internal utility function getBaseType(), except it returns NULL rather than failing for an invalid type OID. (That behavior is modeled on our experience with other catalog-inquiry

pgsql: Stabilize postgres_fdw test

2024-03-30 Thread Alvaro Herrera
Stabilize postgres_fdw test The test fails when RESET statement_timeout takes longer than 10ms. Avoid the problem by using SET LOCAL instead. Overall, this test is not ideal: 10ms could be shorter than the time to have sent the query to the "remote" server, so it's possible that on some machines

pgsql: doc: Improve "Partition Maintenance" section

2024-03-30 Thread Alvaro Herrera
doc: Improve "Partition Maintenance" section This adds some reference links and clarifies the wording a bit. Author: Robert Treat Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/CABV9wwNGn-pweak6_pvL5PJ1mivDNPKfg0Tck_1oTUETv5Y=d...@mail.gmail.com Branch -- master Details

pgsql: Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.

2024-03-30 Thread Dean Rasheed
Add support for MERGE ... WHEN NOT MATCHED BY SOURCE. This allows MERGE commands to include WHEN NOT MATCHED BY SOURCE actions, which operate on rows that exist in the target relation, but not in the data source. These actions can execute UPDATE, DELETE, or DO NOTHING sub-commands. This is in