fix(Postgres Node): Empty return data fix for Postgres and MySQL (#7016)

This commit is contained in:
Michael Kret
2023-08-25 18:38:09 +03:00
committed by GitHub
parent f02f6b659a
commit 176ccd62bc
9 changed files with 86 additions and 22 deletions

View File

@@ -167,7 +167,23 @@ export function prepareOutput(
}
if (!returnData.length) {
returnData.push({ json: { success: true } });
if ((options?.nodeVersion as number) < 2.2) {
returnData.push({ json: { success: true } });
} else {
const isSelectQuery = statements
.filter((statement) => !statement.startsWith('--'))
.every((statement) =>
statement
.replace(/\/\*.*?\*\//g, '') // remove multiline comments
.replace(/\n/g, '')
.toLowerCase()
.startsWith('select'),
);
if (!isSelectQuery) {
returnData.push({ json: { success: true } });
}
}
}
return returnData;