We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 41201cf commit 62d9d98Copy full SHA for 62d9d98
1 file changed
scripts/20160909-093108.sql
@@ -0,0 +1,22 @@
1
+create or replace function journal.get_data_type_string(
2
+ p_column information_schema.columns
3
+) returns varchar language plpgsql as $$
4
+declare
5
+ journal_data_type text;
6
+begin
7
+ IF p_column.data_type = 'numeric' THEN
8
+ IF p_column.numeric_precision IS NOT NULL AND p_column.numeric_scale IS NOT NULL THEN
9
+ journal_data_type := p_column.data_type || '(' || p_column.numeric_precision::varchar || ',' || p_column.numeric_scale::varchar || ')';
10
+ ELSE
11
+ journal_data_type := p_column.data_type;
12
+ END IF;
13
+ ELSEIF p_column.data_type IN ('character', 'character varying', '"char"') THEN
14
+ journal_data_type := 'text';
15
16
17
18
+
19
+ return journal_data_type;
20
+end;
21
+$$;
22
0 commit comments