fix: remove redundant field from ParameterInfo

This commit is contained in:
Nybkox
2024-11-28 09:57:59 +01:00
parent 6b155083ef
commit 926949dc89
4 changed files with 23 additions and 24 deletions

View File

@@ -197,34 +197,36 @@ class Analyser extends DatabaseAnalyser {
.filter(i => i.routine_type == 'PROCEDURE')
.map(i => ({
objectId: 'procedures:' + i.specific_schema + '.' + i.routine_name + '@' + i.pure_name,
routineName: i.routine_name,
pureName: i.pure_name,
parameterName: i.parameter_name,
dataType: i.data_type,
fullDataType: i.data_type,
isOutputParameter: i.is_output_parameter,
parameterMode: i.parameter_mode,
schemaName: i.schema_name,
}));
const procedureNameToParameters = procedurePerameters.reduce((acc, row) => {
if (!acc[row.routineName]) acc[row.routineName] = [];
acc[row.routineName].push(row);
if (!acc[row.pureName]) acc[row.pureName] = [];
acc[row.pureName].push(row);
return acc;
}, {});
const fucntionPerameters = routineParametersRows.rows
const functionParameters = routineParametersRows.rows
.filter(i => i.routine_type == 'FUNCTION')
.map(i => ({
objectId: 'functions:' + i.specific_schema + '.' + i.routine_name + '@' + i.pure_name,
routineName: i.routine_name,
pureName: i.pure_name,
parameterName: i.parameter_name,
dataType: i.data_type,
fullDataType: i.data_type,
isOutputParameter: i.is_output_parameter,
parameterMode: i.parameter_mode,
schemaName: i.schema_name,
}));
const functionNameToParameters = fucntionPerameters.reduce((acc, row) => {
if (!acc[row.routineName]) acc[row.routineName] = [];
acc[row.routineName].push(row);
const functionNameToParameters = functionParameters.reduce((acc, row) => {
if (!acc[row.pureName]) acc[row.pureName] = [];
acc[row.pureName].push(row);
return acc;
}, {});

View File

@@ -1,16 +1,17 @@
module.exports = `
SELECT
proc.specific_schema AS specific_schema,
proc.routine_name AS routine_name,
proc.specific_schema AS schema_name,
proc.routine_name AS pure_name,
proc.routine_type as routine_type,
args.parameter_name AS pure_name,
args.parameter_name AS parameter_name,
args.parameter_mode,
args.data_type AS data_type,
args.ordinal_position AS parameter_index,
args.parameter_mode AS parameter_mode,
CASE
WHEN args.parameter_mode IN ('OUT', 'INOUT') THEN TRUE
ELSE FALSE
END AS is_output_paramter
END AS is_output_parameter
FROM
information_schema.routines proc
LEFT JOIN
@@ -21,7 +22,7 @@ WHERE
proc.routine_schema NOT IN ('pg_catalog', 'information_schema') -- Exclude system schemas
AND proc.routine_type IN ('PROCEDURE', 'FUNCTION') -- Filter for procedures
ORDER BY
specific_schema,
routine_name,
schema_name,
parameter_name,
args.ordinal_position;
`;