Skip to content

Commit

Permalink
[Fix][metadata] Fix postgres schema error (DataLinkDC#1775)
Browse files Browse the repository at this point in the history
* fix postgres schema error

* fix postgres schema

* fix postgres schema

---------

Co-authored-by: aiwenmo <32723967+aiwenmo@users.noreply.github.com>
  • Loading branch information
javaht and aiwenmo authored Mar 25, 2023
1 parent de772eb commit f0179b4
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ public String columnsSql(String schemaName, String tableName) {
+ " , col.numeric_scale as numeric_scale\n"
+ " , col.ordinal_position as ordinal_position\n"
+ " , col.udt_name as type\n"
+ " , (CASE\n"
+ " WHEN (SELECT COUNT(*) FROM pg_constraint AS PC WHERE b.attnum = PC.conkey[1] AND PC.contype = 'p' and PC.conname like concat('"
+ " , (CASE WHEN (SELECT COUNT(*) FROM pg_constraint AS PC WHERE b.attnum = PC.conkey[1] AND PC.contype = 'p' and PC.conname ='"
+ tableName
+ "','_%')) > 0\n"
+ " THEN 'PRI'\n"
+ "'||'_pkey') > 0 THEN 'PRI' \n"
+ " ELSE '' END) AS key\n"
+ " , col_description(c.oid, col.ordinal_position) AS comment\n"
+ " , col.column_default AS column_default\n"
Expand All @@ -71,8 +69,7 @@ public String columnsSql(String schemaName, String tableName) {
+ " LEFT JOIN pg_attribute b ON b.attrelid = c.oid AND b.attname = col.column_name\n"
+ "WHERE col.table_schema = '"
+ schemaName
+ "'\n"
+ " AND col.table_name = '"
+ "' AND col.table_name = '"
+ tableName
+ "'\n"
+ "ORDER BY col.table_schema, col.table_name, col.ordinal_position";
Expand Down

0 comments on commit f0179b4

Please sign in to comment.