fix(Postgres Node): Option to treat query parameters enclosed in single quotas as text (#10214)

This commit is contained in:
Michael Kret
2024-07-29 14:48:11 +03:00
committed by GitHub
parent 24ffca7c75
commit 00ec253337
4 changed files with 93 additions and 0 deletions

View File

@@ -109,6 +109,16 @@ export async function execute(
}
}
if (!queryReplacement || nodeOptions.treatQueryParametersInSingleQuotesAsText) {
let nextValueIndex = values.length + 1;
const literals = query.match(/'\$[0-9]+'/g) ?? [];
for (const literal of literals) {
query = query.replace(literal, `$${nextValueIndex}`);
values.push(literal.replace(/'/g, ''));
nextValueIndex++;
}
}
queries.push({ query, values });
}