mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Postgres Node): Connection pool of the database object has been destroyed (#7074)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -18,6 +18,7 @@ import type {
|
||||
import {
|
||||
addReturning,
|
||||
checkItemAgainstSchema,
|
||||
configureTableSchemaUpdater,
|
||||
doesRowExist,
|
||||
getTableSchema,
|
||||
prepareItem,
|
||||
@@ -198,19 +199,31 @@ export async function execute(
|
||||
db: PgpDatabase,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
items = replaceEmptyStringsByNulls(items, nodeOptions.replaceEmptyStrings as boolean);
|
||||
const nodeVersion = nodeOptions.typeVersion as number;
|
||||
|
||||
let schema = this.getNodeParameter('schema', 0, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
let table = this.getNodeParameter('table', 0, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
const updateTableSchema = configureTableSchemaUpdater(schema, table);
|
||||
|
||||
let tableSchema = await getTableSchema(db, schema, table);
|
||||
|
||||
const queries: QueryWithValues[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const schema = this.getNodeParameter('schema', i, undefined, {
|
||||
schema = this.getNodeParameter('schema', i, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
const table = this.getNodeParameter('table', i, undefined, {
|
||||
table = this.getNodeParameter('table', i, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
const nodeVersion = this.getNode().typeVersion;
|
||||
const columnsToMatchOn: string[] =
|
||||
nodeVersion < 2.2
|
||||
? [this.getNodeParameter('columnToMatchOn', i) as string]
|
||||
@@ -286,7 +299,7 @@ export async function execute(
|
||||
}
|
||||
}
|
||||
|
||||
const tableSchema = await getTableSchema(db, schema, table);
|
||||
tableSchema = await updateTableSchema(db, tableSchema, schema, table);
|
||||
|
||||
item = checkItemAgainstSchema(this.getNode(), item, tableSchema, i);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user