Unverified Commit f0179b40 authored by javaht's avatar javaht Committed by GitHub

[Fix][metadata] Fix postgres schema error (#1775)

* fix postgres schema error * fix postgres schema * fix postgres schema --------- Co-authored-by: 's avataraiwenmo <32723967+aiwenmo@users.noreply.github.com>
parent de772eb5
...@@ -57,11 +57,9 @@ public class PostgreSqlQuery extends AbstractDBQuery { ...@@ -57,11 +57,9 @@ public class PostgreSqlQuery extends AbstractDBQuery {
+ " , col.numeric_scale as numeric_scale\n" + " , col.numeric_scale as numeric_scale\n"
+ " , col.ordinal_position as ordinal_position\n" + " , col.ordinal_position as ordinal_position\n"
+ " , col.udt_name as type\n" + " , col.udt_name as type\n"
+ " , (CASE\n" + " , (CASE WHEN (SELECT COUNT(*) FROM pg_constraint AS PC WHERE b.attnum = PC.conkey[1] AND PC.contype = 'p' and PC.conname ='"
+ " WHEN (SELECT COUNT(*) FROM pg_constraint AS PC WHERE b.attnum = PC.conkey[1] AND PC.contype = 'p' and PC.conname like concat('"
+ tableName + tableName
+ "','_%')) > 0\n" + "'||'_pkey') > 0 THEN 'PRI' \n"
+ " THEN 'PRI'\n"
+ " ELSE '' END) AS key\n" + " ELSE '' END) AS key\n"
+ " , col_description(c.oid, col.ordinal_position) AS comment\n" + " , col_description(c.oid, col.ordinal_position) AS comment\n"
+ " , col.column_default AS column_default\n" + " , col.column_default AS column_default\n"
...@@ -71,8 +69,7 @@ public class PostgreSqlQuery extends AbstractDBQuery { ...@@ -71,8 +69,7 @@ public class PostgreSqlQuery extends AbstractDBQuery {
+ " LEFT JOIN pg_attribute b ON b.attrelid = c.oid AND b.attname = col.column_name\n" + " LEFT JOIN pg_attribute b ON b.attrelid = c.oid AND b.attname = col.column_name\n"
+ "WHERE col.table_schema = '" + "WHERE col.table_schema = '"
+ schemaName + schemaName
+ "'\n" + "' AND col.table_name = '"
+ " AND col.table_name = '"
+ tableName + tableName
+ "'\n" + "'\n"
+ "ORDER BY col.table_schema, col.table_name, col.ordinal_position"; + "ORDER BY col.table_schema, col.table_name, col.ordinal_position";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment