mirror of https://github.com/citusdata/citus.git
Fix creating stats bug when CREATE TABLE LIKE (#6006)
parent
184c7c0bce
commit
1ee3e8b7f4
|
@ -42,6 +42,12 @@ QualifyCreateStatisticsStmt(Node *node)
|
|||
relation->schemaname = get_namespace_name(schemaOid);
|
||||
}
|
||||
|
||||
if (list_length(stmt->defnames) < 1)
|
||||
{
|
||||
/* no name to qualify */
|
||||
return;
|
||||
}
|
||||
|
||||
RangeVar *stat = makeRangeVarFromNameList(stmt->defnames);
|
||||
|
||||
if (stat->schemaname == NULL)
|
||||
|
|
|
@ -1364,6 +1364,18 @@ SELECT count(*) FROM pg14.foreign_table;
|
|||
TRUNCATE foreign_table;
|
||||
ERROR: truncating foreign tables that are added to metadata can only be executed on the coordinator
|
||||
\c - - - :master_port
|
||||
SET search_path TO pg14;
|
||||
-- an example with CREATE TABLE LIKE, with statistics with expressions
|
||||
CREATE TABLE ctlt1 (a text CHECK (length(a) > 2) PRIMARY KEY, b text);
|
||||
CREATE STATISTICS ctlt1_expr_stat ON (a || b) FROM ctlt1;
|
||||
CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
|
||||
SELECT create_distributed_table('ctlt1', 'a');
|
||||
create_distributed_table
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
CREATE TABLE ctlt_all_2 (LIKE ctlt1 INCLUDING ALL);
|
||||
-- cleanup
|
||||
set client_min_messages to error;
|
||||
drop extension postgres_fdw cascade;
|
||||
|
|
|
@ -706,6 +706,13 @@ SELECT count(*) FROM pg14.foreign_table;
|
|||
-- should error out
|
||||
TRUNCATE foreign_table;
|
||||
\c - - - :master_port
|
||||
SET search_path TO pg14;
|
||||
-- an example with CREATE TABLE LIKE, with statistics with expressions
|
||||
CREATE TABLE ctlt1 (a text CHECK (length(a) > 2) PRIMARY KEY, b text);
|
||||
CREATE STATISTICS ctlt1_expr_stat ON (a || b) FROM ctlt1;
|
||||
CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
|
||||
SELECT create_distributed_table('ctlt1', 'a');
|
||||
CREATE TABLE ctlt_all_2 (LIKE ctlt1 INCLUDING ALL);
|
||||
-- cleanup
|
||||
set client_min_messages to error;
|
||||
drop extension postgres_fdw cascade;
|
||||
|
|
Loading…
Reference in New Issue