diff --git a/chat2db-server/chat2db-plugins/chat2db-postgresql/src/main/java/ai/chat2db/plugin/postgresql/consts/SQLConst.java b/chat2db-server/chat2db-plugins/chat2db-postgresql/src/main/java/ai/chat2db/plugin/postgresql/consts/SQLConst.java index 22fe5e91..0938f348 100644 --- a/chat2db-server/chat2db-plugins/chat2db-postgresql/src/main/java/ai/chat2db/plugin/postgresql/consts/SQLConst.java +++ b/chat2db-server/chat2db-plugins/chat2db-postgresql/src/main/java/ai/chat2db/plugin/postgresql/consts/SQLConst.java @@ -42,7 +42,7 @@ public class SQLConst { + " -- 约束\n" + " tableScript:= tableScript || chr(13)||chr(10) || array_to_string(\n" + " array(\n" - + " select concat(' CONSTRAINT ',conname ,c ,u,p,f) from (\n" + + " select concat(' CONSTRAINT ', conname || '_' || tablename ,c ,u,p,f) from (\n" + " select conname,\n" + " case when contype='c' then ' CHECK('|| ( select findattname(namespace,tablename,'c') ) ||')' " + "end " @@ -109,13 +109,13 @@ public class SQLConst { + " -- COMMENT COMMENT ON COLUMN sys_activity.id IS '主键';\n" + " tableScript:= tableScript || chr(13)||chr(10) || chr(13)||chr(10) || array_to_string(\n" + " array(\n" - + " SELECT 'COMMENT ON COLUMN ' || tablename || '.' || a.attname ||' IS '|| ''''|| d.description " + + " SELECT 'COMMENT ON COLUMN ' || 'namespace.tablename' || '.' || a.attname ||' IS '|| ''''|| d.description " + "||''''\n" + " FROM pg_class c\n" + " JOIN pg_description d ON c.oid=d.objoid\n" + " JOIN pg_attribute a ON c.oid = a.attrelid\n" + " WHERE c.relname=tablename\n" - + " AND a.attnum = d.objsubid),','|| chr(13)||chr(10)) ;\n" + + " AND a.attnum = d.objsubid),';'|| chr(13)||chr(10)) ;\n" + "\n" + " return tableScript;\n" + "\n"