postgre function analyser

This commit is contained in:
Jan Prochazka
2021-06-10 14:11:26 +02:00
parent f5ea87da7b
commit 3fa71cc94a
3 changed files with 9 additions and 0 deletions

View File

@@ -139,6 +139,7 @@ class Analyser extends DatabaseAnalyser {
.filter(x => x.object_type == 'FUNCTION')
.map(func => ({
objectId: `functions:${func.schema_name}.${func.pure_name}`,
createSql: `CREATE FUNCTION "${func.schema_name}"."${func.pure_name}"() RETURNS ${func.data_type} LANGUAGE ${func.language}\nAS\n$$\n${func.definition}\n$$`,
pureName: func.pure_name,
schemaName: func.schema_name,
contentHash: func.hash_code,

View File

@@ -5,6 +5,7 @@ select
routine_definition as "definition",
md5(routine_definition) as "hash_code",
routine_type as "object_type",
data_type as "data_type",
external_language as "language"
from
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog'