From 373a35fe6550c6169c9671979626174ae971b1e0 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Wed, 29 May 2024 07:09:43 +0200 Subject: [PATCH] Revert "Merge pull request #744 from Bare7a/postgresql-user-type-enhancements" This reverts commit fdabe1eeaa0ff0bfd6a67d670945fc1b6ed3c2c0, reversing changes made to 4429b1d6182b833dff4fd29baa70965962229f91. --- plugins/dbgate-plugin-postgres/src/backend/sql/columns.js | 8 ++------ .../src/backend/sql/tableModifications.js | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/dbgate-plugin-postgres/src/backend/sql/columns.js b/plugins/dbgate-plugin-postgres/src/backend/sql/columns.js index d2c92ca5..0be8a81d 100644 --- a/plugins/dbgate-plugin-postgres/src/backend/sql/columns.js +++ b/plugins/dbgate-plugin-postgres/src/backend/sql/columns.js @@ -4,11 +4,7 @@ select table_name as "pure_name", column_name as "column_name", is_nullable as "is_nullable", - case - when (data_type = 'USER-DEFINED' OR data_type = 'ARRAY') then udt_name::regtype::text - else data_type - end - as "data_type", + data_type as "data_type", character_maximum_length as "char_max_length", numeric_precision as "numeric_precision", numeric_scale as "numeric_scale", @@ -24,4 +20,4 @@ where ('views:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION ) order by ordinal_position -`; +`; \ No newline at end of file diff --git a/plugins/dbgate-plugin-postgres/src/backend/sql/tableModifications.js b/plugins/dbgate-plugin-postgres/src/backend/sql/tableModifications.js index b8ad3691..700405da 100644 --- a/plugins/dbgate-plugin-postgres/src/backend/sql/tableModifications.js +++ b/plugins/dbgate-plugin-postgres/src/backend/sql/tableModifications.js @@ -2,7 +2,7 @@ module.exports = ` select infoTables.table_schema as "schema_name", infoTables.table_name as "pure_name", ( select md5(string_agg( - infoColumns.column_name || '|' || case when (infoColumns.data_type = 'USER-DEFINED' OR infoColumns.data_type = 'ARRAY') then infoColumns.udt_name::regtype::text else infoColumns.data_type end || '|' || infoColumns.is_nullable::varchar(255) || '|' || coalesce(infoColumns.character_maximum_length, -1)::varchar(255) + infoColumns.column_name || '|' || infoColumns.data_type || '|' || infoColumns.is_nullable::varchar(255) || '|' || coalesce(infoColumns.character_maximum_length, -1)::varchar(255) || '|' || coalesce(infoColumns.numeric_precision, -1)::varchar(255) , ',' order by infoColumns.ordinal_position )) as "hash_code_columns"