暂无图片
antdb数据库提示“cannot create foreign key whose evaluation cannot be enforced to Remote nodes”。
我来答
分享
低负荷
2023-03-22
antdb数据库提示“cannot create foreign key whose evaluation cannot be enforced to Remote nodes”。

请教一下,antdb数据库提示“cannot create foreign key whose evaluation cannot be enforced to Remote nodes”,这该怎么解决?

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
暂无图片
亚信安慧AntDB数据库

解决方式

目前不允许在非分片键上创建外键,处理方式:

修改子表外键字段为分片键后再创建外键。
如果父表数据量很小的话,可以修改父表的为复制表。

复现SQL:

antdb=# create table t_parent (id int primary key,name varchar(30));
create table t_child (id int,name varchar(30)) distribute by hash(name);

CREATE TABLE
antdb=# create table t_child (id int,name varchar(30)) distribute by hash(name);
CREATE TABLE
antdb=#
antdb=# alter table t_child
postgres-# add constraint fkey_t_child
postgres-# foreign key (id)
postgres-# references t_parent (id);
ERROR: Cannot create foreign key whose evaluation cannot be enforced to remote nodes
antdb=#
antdb=# alter table t_child distribute by hash (id);
ALTER TABLE
antdb=# alter table t_child
add constraint fkey_t_child
foreign key (id)
references t_parent (id);
ALTER TABLE

antdb=# drop table t_child;
DROP TABLE
antdb=# create table t_child (id int,name varchar(30)) distribute by hash(name);
CREATE TABLE
antdb=# alter table t_parent distribute by replication;
ALTER TABLE
antdb=# alter table t_child
postgres-# add constraint fkey_t_child
postgres-# foreign key (id)
postgres-# references t_parent (id);
ALTER TABLE
antdb=#

fe_sendauth: no password supplied

可能的报错信息:

WARNING: on coordinator execute "set FORCE_PARALLEL_MODE = off; SELECT adb_PAUSE_CLUSTER();" fail ERROR: error message from poolmgr:reconnect three thimes , fe_sendauth: no password supplied

处理方式:
检查下集群中coord的hba信息,是否存在:对于集群内部主机IP有md5的认证方式。

在adbmgr中执行 :show hba nodename 来查看节点的hba信息。
FATAL: invalid value for parameter “TimeZone”: “Asia/Shanghai”

可能的报错信息:

FATAL: invalid value for parameter "TimeZone": "Asia/Shanghai"
FATAL: invalid value for parameter "TimeZone": "asia/shanghai"
FATAL: invalid value for parameter "TimeZone": "utc"

处理方式:

检查JDBC的JAVA_OPTS,是否配置了user.timezone参数,若配置了该参数,需严格匹配数据库内默认支持的时区名的大小写。

数据库内支持的时区,使用下列sql查询,注意时区名的大小写。

select * from adb_catalog.adb_timezone_names;

若JDBC中没有配置该参数,则按步骤2的说明检查。

检查AntDB二进制文件目录下的share,并确认timezone下的时区是否完整。若缺失或不完整,需要重新从一个完整的节点deploy所需的文件。

ll $ADBHOME/share/postgresql/timezone
total 232
drwxr-xr-x 2 antdb antdb 4096 Apr 16 15:59 Africa
drwxr-xr-x 6 antdb antdb 4096 Apr 16 15:59 America
drwxr-xr-x 2 antdb antdb 4096 Apr 16 15:59 Antarctica
drwxr-xr-x 2 antdb antdb 25 Apr 16 15:59 Arctic
drwxr-xr-x 2 antdb antdb 4096 Apr 16 15:59 Asia
......
drwxr-xr-x 2 antdb antdb 4096 Apr 16 15:59 US
-rwxr-xr-x 1 antdb antdb 114 Apr 16 15:48 UTC
-rwxr-xr-x 1 antdb antdb 1905 Apr 16 15:48 WET
-rwxr-xr-x 1 antdb antdb 1535 Apr 16 15:48 W-SU
-rwxr-xr-x 1 antdb antdb 114 Apr 16 15:48 Zulu

暂无图片 评论
暂无图片 有用 2
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏