简体   繁体   中英

Citus “create_distributed_table” giving “PG::UndefinedColumn”

When trying to create a distributed table with Citus, it gives a PG::UndefinedColumn: ERROR: column "x" does not exist

I have enabled Citus on workers and main DB:

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

I created a composite primary key:

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);
")

When trying to do:

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

It keeps saying:

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

Is there something I am forgetting?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM