pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Clamp total-tuples estimates for foreign tables to ensure planne

2020-07-03 Thread Tom Lane
Clamp total-tuples estimates for foreign tables to ensure planner sanity. After running GetForeignRelSize for a foreign table, adjust rel->tuples to be at least as large as rel->rows. This prevents bizarre behavior in estimate_num_groups() and perhaps other places, especially in the scenario wher

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Fix temporary tablespaces for shared filesets some more.

2020-07-03 Thread Tom Lane
Fix temporary tablespaces for shared filesets some more. Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the d

pgsql: Inline plpgsql's exec_stmt() into exec_stmts().

2020-07-03 Thread Tom Lane
Inline plpgsql's exec_stmt() into exec_stmts(). This saves one level of C function call per plpgsql statement executed, and permits a tiny additional optimization of not saving and restoring estate->err_stmt for each statement in a block. The net effect seems nearly un-measurable on x86_64, but t

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par

pgsql: Fix temporary tablespaces for shared filesets

2020-07-03 Thread Magnus Hagander
Fix temporary tablespaces for shared filesets A likely copy/paste error in 98e8b480532 from back in 2004 would cause temp tablespace to be reset to InvalidOid if temp_tablespaces was set to the same value as the primary tablespace in the database. This would cause shared filesets (such as for par