0

当试图用 Citus 创建一个分布式表时,它给出了一个PG::UndefinedColumn: ERROR: column "x" does not exist

我在工作人员和主数据库上启用了 Citus:

SELECT run_command_on_workers($cmd$
  CREATE EXTENSION citus;
$cmd$);

我创建了一个复合主键:

ActiveRecord::Base.connection.execute("
  ALTER TABLE x DROP CONSTRAINT x_pkey CASCADE;
")
ActiveRecord::Base.connection.execute("
  ALTER TABLE x ADD PRIMARY KEY (tenant_id, id);
")

尝试这样做时:

ActiveRecord::Base.connection.execute("
SELECT create_distributed_table(x, tenant_id);
")

它一直在说:

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR:  column "x" does not exist
LINE 2: SELECT create_distributed_table(x, tenant_id...
                                        ^
Caused by PG::UndefinedColumn: ERROR:  column "x" does not exist

有什么我忘记了吗?

4

1 回答 1

1

表名和列名需要作为单引号中的文本值传递: SELECT create_distributed_table('x', 'tenant_id');

于 2020-09-09T11:06:19.593 回答