mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +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:
@@ -17,6 +17,7 @@ import type {
|
||||
import {
|
||||
addReturning,
|
||||
checkItemAgainstSchema,
|
||||
configureTableSchemaUpdater,
|
||||
getTableSchema,
|
||||
prepareItem,
|
||||
replaceEmptyStringsByNulls,
|
||||
@@ -161,15 +162,28 @@ 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;
|
||||
|
||||
@@ -183,7 +197,6 @@ export async function execute(
|
||||
let query = `INSERT INTO $1:name.$2:name($3:name) VALUES($3:csv)${onConflict}`;
|
||||
let values: QueryValues = [schema, table];
|
||||
|
||||
const nodeVersion = this.getNode().typeVersion;
|
||||
const dataMode =
|
||||
nodeVersion < 2.2
|
||||
? (this.getNodeParameter('dataMode', i) as string)
|
||||
@@ -209,7 +222,7 @@ export async function execute(
|
||||
}
|
||||
}
|
||||
|
||||
const tableSchema = await getTableSchema(db, schema, table);
|
||||
tableSchema = await updateTableSchema(db, tableSchema, schema, table);
|
||||
|
||||
values.push(checkItemAgainstSchema(this.getNode(), item, tableSchema, i));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
getTableSchema,
|
||||
prepareItem,
|
||||
replaceEmptyStringsByNulls,
|
||||
configureTableSchemaUpdater,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
import { optionsCollection } from '../common.descriptions';
|
||||
@@ -197,19 +198,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]
|
||||
@@ -255,7 +268,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