pgsql: Refactor user-facing SQL functions signalling backends

2018-10-04 Thread Michael Paquier
Refactor user-facing SQL functions signalling backends This moves the system administration functions for signalling backends from backend/utils/adt/misc.c into a separate file dedicated to backend signalling. No new functionality is introduced in this commit. Author: Daniel Gustafsson Reviewed-

pgsql: Fix duplicate primary keys in partitions

2018-10-04 Thread Alvaro Herrera
Fix duplicate primary keys in partitions When using the CREATE TABLE .. PARTITION OF syntax, it's possible to cause a partition to get two primary keys if the parent already has one. Tighten the check to disallow that. Reported-by: Rajkumar Raghuwanshi Author: Amul Sul Discussion: https://postgr

pgsql: Fix duplicate primary keys in partitions

2018-10-04 Thread Alvaro Herrera
Fix duplicate primary keys in partitions When using the CREATE TABLE .. PARTITION OF syntax, it's possible to cause a partition to get two primary keys if the parent already has one. Tighten the check to disallow that. Reported-by: Rajkumar Raghuwanshi Author: Amul Sul Discussion: https://postgr

pgsql: Centralize executor's opening/closing of Relations for rangetabl

2018-10-04 Thread Tom Lane
Centralize executor's opening/closing of Relations for rangetable entries. Create an array estate->es_relations[] paralleling the es_range_table, and store references to Relations (relcache entries) there, so that any given RT entry is opened and closed just once per executor run. Scan nodes typi

pgsql: In the executor, use an array of pointers to access the rangetab

2018-10-04 Thread Tom Lane
In the executor, use an array of pointers to access the rangetable. Instead of doing a lot of list_nth() accesses to es_range_table, create a flattened pointer array during executor startup and index into that to get at individual RangeTblEntrys. This eliminates one source of O(N^2) behavior with

pgsql: Add pg_ls_tmpdir function

2018-10-04 Thread Michael Paquier
Add pg_ls_tmpdir function This lists the contents of a temporary directory associated to a given tablespace, useful to get information about on-disk consumption caused by temporary files used by a session query. By default, pg_default is scanned, and a tablespace can be specified as argument. Th