/** * Postgres Node - Version 2.3 * Get, add and update data in Postgres */ export interface PostgresV23Params { resource?: unknown; /** * Operation * @displayOptions.show { resource: ["database"] } * @default insert */ operation?: 'deleteTable' | 'executeQuery' | 'insert' | 'upsert' | 'select' | 'update'; /** * The schema that contains the table you want to work on * @displayOptions.hide { operation: ["executeQuery"] } * @default {"mode":"list","value":"public"} */ schema?: { __rl: true; mode: 'list' | 'name'; value: string; cachedResultName?: string }; /** * The table you want to work on * @displayOptions.hide { operation: ["executeQuery"] } * @default {"mode":"list","value":""} */ table?: { __rl: true; mode: 'list' | 'name'; value: string; cachedResultName?: string }; /** * Command * @displayOptions.show { resource: ["database"], operation: ["deleteTable"] } * @displayOptions.hide { table: [""] } * @default truncate */ deleteCommand?: 'truncate' | 'delete' | 'drop' | Expression; /** * Whether to reset identity (auto-increment) columns to their initial values * @displayOptions.show { deleteCommand: ["truncate"], resource: ["database"], operation: ["deleteTable"] } * @displayOptions.hide { table: [""] } * @default false */ restartSequences?: boolean | Expression; /** * If not set, all rows will be selected * @displayOptions.show { deleteCommand: ["delete"], resource: ["database"], operation: ["deleteTable", "select"] } * @displayOptions.hide { table: [""] } * @default {} */ where?: { /** Values */ values?: Array<{ /** Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/" target="_blank">expression</a> */ column?: string | Expression; /** The operator to check the column against. When using 'LIKE' operator percent sign ( %) matches zero or more characters, underscore ( _ ) matches any single character. * @default equal */ condition?: 'equal' | '!=' | 'LIKE' | '>' | '<' | '>=' | '<=' | 'IS NULL' | 'IS NOT NULL' | Expression; /** Value * @displayOptions.hide { condition: ["IS NULL", "IS NOT NULL"] } */ value?: string | Expression | PlaceholderValue; }>; }; /** * How to combine the conditions defined in "Select Rows": AND requires all conditions to be true, OR requires at least one condition to be true * @displayOptions.show { deleteCommand: ["delete"], resource: ["database"], operation: ["deleteTable", "select"] } * @displayOptions.hide { table: [""] } * @default AND */ combineConditions?: 'AND' | 'OR' | Expression; /** * Options * @displayOptions.show { resource: ["database"], operation: ["deleteTable", "executeQuery", "insert", "select", "update", "upsert"] } * @displayOptions.hide { table: [""] } * @default {} */ options?: { /** Whether to drop all objects that depend on the table, such as views and sequences * @displayOptions.show { /operation: ["deleteTable"] } * @displayOptions.hide { /deleteCommand: ["delete"] } * @default false */ cascade?: boolean | Expression; /** Number of seconds reserved for connecting to the database * @default 30 */ connectionTimeout?: number | Expression; /** Number of seconds to wait before idle connection would be eligible for closing * @default 0 */ delayClosingIdleConnection?: number | Expression; /** The way queries should be sent to the database * @default single */ queryBatching?: 'single' | 'independently' | 'transaction'; /** Comma-separated list of the values you want to use as query parameters. <a href="https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.postgres/#use-query-parameters" target="_blank">More info</a>. * @hint Comma-separated list of values: reference them in your query as $1, $2, $3… * @displayOptions.show { /operation: ["executeQuery"] } */ queryReplacement?: string | Expression | PlaceholderValue; /** Whether to treat query parameters enclosed in single quotes as text e.g. '$1' * @displayOptions.show { queryReplacement: [{"_cnd":{"exists":true}}] } * @default false */ treatQueryParametersInSingleQuotesAsText?: boolean | Expression; /** Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/" target="_blank">expression</a> * @displayOptions.show { /operation: ["select", "insert", "update", "upsert"] } * @default [] */ outputColumns?: string[]; /** Output Large-Format Numbers As * @hint Applies to NUMERIC and BIGINT columns only * @default text */ largeNumbersOutput?: 'numbers' | 'text' | Expression; /** Whether to skip the row and do not throw error if a unique constraint or exclusion constraint is violated * @displayOptions.show { /operation: ["insert"] } * @default false */ skipOnConflict?: boolean | Expression; /** Whether to replace empty strings with NULL in input, could be useful when data come from spreadsheet * @displayOptions.show { /operation: ["insert", "update", "upsert", "executeQuery"] } * @default false */ replaceEmptyStrings?: boolean | Expression; }; /** * The SQL query to execute. You can use n8n expressions and $1, $2, $3, etc to refer to the 'Query Parameters' set in options below. * @hint Consider using query parameters to prevent SQL injection attacks. Add them in the options below * @displayOptions.show { resource: ["database"], operation: ["executeQuery"] } */ query?: string; /** * Columns * @displayOptions.show { resource: ["database"], operation: ["insert", "update", "upsert"] } * @displayOptions.hide { table: [""] } * @default {"mappingMode":"defineBelow","value":null} */ columns?: string; /** * Whether to return all results or only up to a given limit * @displayOptions.show { resource: ["database"], operation: ["select"] } * @displayOptions.hide { table: [""] } * @default false */ returnAll?: boolean | Expression; /** * Max number of results to return * @displayOptions.show { returnAll: [false], resource: ["database"], operation: ["select"] } * @displayOptions.hide { table: [""] } * @default 50 */ limit?: number | Expression; /** * Sort * @displayOptions.show { resource: ["database"], operation: ["select"] } * @displayOptions.hide { table: [""] } * @default {} */ sort?: { /** Values */ values?: Array<{ /** Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/" target="_blank">expression</a> */ column?: string | Expression; /** Direction * @default ASC */ direction?: 'ASC' | 'DESC' | Expression; }>; }; } export interface PostgresV23Credentials { postgres: CredentialReference; } interface PostgresV23NodeBase { type: 'n8n-nodes-base.postgres'; version: 2.3; credentials?: PostgresV23Credentials; } export type PostgresV23ParamsNode = PostgresV23NodeBase & { config: NodeConfig; }; export type PostgresV23Node = PostgresV23ParamsNode;