diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json
index f648d3137f..799f5c7a8a 100644
--- a/packages/editor-ui/package.json
+++ b/packages/editor-ui/package.json
@@ -30,6 +30,7 @@
"@codemirror/commands": "^6.1.0",
"@codemirror/lang-javascript": "^6.1.2",
"@codemirror/lang-json": "^6.0.1",
+ "@codemirror/lang-sql": "^6.4.1",
"@codemirror/language": "^6.2.1",
"@codemirror/lint": "^6.0.0",
"@codemirror/state": "^6.1.4",
diff --git a/packages/editor-ui/src/components/ParameterInput.vue b/packages/editor-ui/src/components/ParameterInput.vue
index 44e31041c2..6f71269433 100644
--- a/packages/editor-ui/src/components/ParameterInput.vue
+++ b/packages/editor-ui/src/components/ParameterInput.vue
@@ -103,6 +103,14 @@
@valueChanged="valueChangedDebounced"
/>
+
+
+
+
+
+
diff --git a/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts b/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts
index a11ff18670..6bc61ee8ac 100644
--- a/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts
+++ b/packages/nodes-base/nodes/CrateDb/CrateDb.node.ts
@@ -73,6 +73,10 @@ export class CrateDb implements INodeType {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ sqlDialect: 'postgres',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts b/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts
index a806e5afac..0e78130098 100644
--- a/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts
+++ b/packages/nodes-base/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.ts
@@ -14,6 +14,9 @@ const properties: INodeProperties[] = [
displayName: 'SQL Query',
name: 'sqlQuery',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ },
displayOptions: {
hide: {
'/options.useLegacySql': [true],
@@ -28,6 +31,9 @@ const properties: INodeProperties[] = [
displayName: 'SQL Query',
name: 'sqlQuery',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ },
displayOptions: {
show: {
'/options.useLegacySql': [true],
diff --git a/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts b/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts
index 8c7c00dee2..14a39fdddb 100644
--- a/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts
+++ b/packages/nodes-base/nodes/Microsoft/Sql/MicrosoftSql.node.ts
@@ -90,6 +90,10 @@ export class MicrosoftSql implements INodeType {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ sqlDialect: 'mssql',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/nodes-base/nodes/MySql/v1/MySqlV1.node.ts b/packages/nodes-base/nodes/MySql/v1/MySqlV1.node.ts
index 21759b3e45..f54807ef41 100644
--- a/packages/nodes-base/nodes/MySql/v1/MySqlV1.node.ts
+++ b/packages/nodes-base/nodes/MySql/v1/MySqlV1.node.ts
@@ -72,6 +72,10 @@ const versionDescription: INodeTypeDescription = {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ sqlDialect: 'mysql',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/nodes-base/nodes/MySql/v2/actions/database/executeQuery.operation.ts b/packages/nodes-base/nodes/MySql/v2/actions/database/executeQuery.operation.ts
index bf247596d3..853be02ac3 100644
--- a/packages/nodes-base/nodes/MySql/v2/actions/database/executeQuery.operation.ts
+++ b/packages/nodes-base/nodes/MySql/v2/actions/database/executeQuery.operation.ts
@@ -21,7 +21,8 @@ const properties: INodeProperties[] = [
description:
"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.",
typeOptions: {
- rows: 3,
+ editor: 'sqlEditor',
+ sqlDialect: 'mysql',
},
hint: 'Prefer using query parameters over n8n expressions to avoid SQL injection attacks',
},
diff --git a/packages/nodes-base/nodes/Postgres/v1/PostgresV1.node.ts b/packages/nodes-base/nodes/Postgres/v1/PostgresV1.node.ts
index ac98d86733..b9190a5945 100644
--- a/packages/nodes-base/nodes/Postgres/v1/PostgresV1.node.ts
+++ b/packages/nodes-base/nodes/Postgres/v1/PostgresV1.node.ts
@@ -71,6 +71,10 @@ const versionDescription: INodeTypeDescription = {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ sqlDialect: 'postgres',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/nodes-base/nodes/Postgres/v2/actions/database/executeQuery.operation.ts b/packages/nodes-base/nodes/Postgres/v2/actions/database/executeQuery.operation.ts
index 41aedcf156..1d59228f0b 100644
--- a/packages/nodes-base/nodes/Postgres/v2/actions/database/executeQuery.operation.ts
+++ b/packages/nodes-base/nodes/Postgres/v2/actions/database/executeQuery.operation.ts
@@ -21,7 +21,8 @@ const properties: INodeProperties[] = [
description:
"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.",
typeOptions: {
- rows: 3,
+ editor: 'sqlEditor',
+ sqlDialect: 'postgres',
},
hint: 'Prefer using query parameters over n8n expressions to avoid SQL injection attacks',
},
diff --git a/packages/nodes-base/nodes/QuestDb/QuestDb.node.ts b/packages/nodes-base/nodes/QuestDb/QuestDb.node.ts
index 5987d4007e..90af31d753 100644
--- a/packages/nodes-base/nodes/QuestDb/QuestDb.node.ts
+++ b/packages/nodes-base/nodes/QuestDb/QuestDb.node.ts
@@ -60,6 +60,10 @@ export class QuestDb implements INodeType {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ sqlDialect: 'postgres',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/nodes-base/nodes/Snowflake/Snowflake.node.ts b/packages/nodes-base/nodes/Snowflake/Snowflake.node.ts
index 8264cdce7a..32ea9e477f 100644
--- a/packages/nodes-base/nodes/Snowflake/Snowflake.node.ts
+++ b/packages/nodes-base/nodes/Snowflake/Snowflake.node.ts
@@ -65,6 +65,9 @@ export class Snowflake implements INodeType {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/nodes-base/nodes/TimescaleDb/TimescaleDb.node.ts b/packages/nodes-base/nodes/TimescaleDb/TimescaleDb.node.ts
index 5a43f7c500..1d0c2c21ac 100644
--- a/packages/nodes-base/nodes/TimescaleDb/TimescaleDb.node.ts
+++ b/packages/nodes-base/nodes/TimescaleDb/TimescaleDb.node.ts
@@ -65,6 +65,10 @@ export class TimescaleDb implements INodeType {
displayName: 'Query',
name: 'query',
type: 'string',
+ typeOptions: {
+ editor: 'sqlEditor',
+ sqlDialect: 'postgres',
+ },
displayOptions: {
show: {
operation: ['executeQuery'],
diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts
index 96898dec2d..9cdfd57e89 100644
--- a/packages/workflow/src/Interfaces.ts
+++ b/packages/workflow/src/Interfaces.ts
@@ -1019,8 +1019,9 @@ export type NodePropertyTypes =
export type CodeAutocompleteTypes = 'function' | 'functionItem';
-export type EditorType = 'code' | 'codeNodeEditor' | 'htmlEditor' | 'json';
+export type EditorType = 'code' | 'codeNodeEditor' | 'htmlEditor' | 'sqlEditor' | 'json';
export type CodeNodeEditorLanguage = 'javaScript' | 'json'; //| 'python' | 'sql';
+export type SQLDialect = 'mssql' | 'mysql' | 'postgres';
export interface ILoadOptions {
routing?: {
@@ -1035,6 +1036,7 @@ export interface INodePropertyTypeOptions {
codeAutocomplete?: CodeAutocompleteTypes; // Supported by: string
editor?: EditorType; // Supported by: string
editorLanguage?: CodeNodeEditorLanguage; // Supported by: string in combination with editor: codeNodeEditor
+ sqlDialect?: SQLDialect; // Supported by: sqlEditor
loadOptionsDependsOn?: string[]; // Supported by: options
loadOptionsMethod?: string; // Supported by: options
loadOptions?: ILoadOptions; // Supported by: options
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c3c5ded5d4..77412c0370 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -844,6 +844,9 @@ importers:
'@codemirror/lang-json':
specifier: ^6.0.1
version: 6.0.1
+ '@codemirror/lang-sql':
+ specifier: ^6.4.1
+ version: 6.4.1(@codemirror/view@6.5.1)(@lezer/common@1.0.1)
'@codemirror/language':
specifier: ^6.2.1
version: 6.2.1
@@ -3367,6 +3370,19 @@ packages:
'@lezer/json': 1.0.0
dev: false
+ /@codemirror/lang-sql@6.4.1(@codemirror/view@6.5.1)(@lezer/common@1.0.1):
+ resolution: {integrity: sha512-PFB56L+A0WGY35uRya+Trt5g19V9k2V9X3c55xoFW4RgiATr/yLqWsbbnEsdxuMn5tLpuikp7Kmj9smRsqBXAg==}
+ dependencies:
+ '@codemirror/autocomplete': 6.4.0(@codemirror/language@6.2.1)(@codemirror/state@6.1.4)(@codemirror/view@6.5.1)(@lezer/common@1.0.1)
+ '@codemirror/language': 6.2.1
+ '@codemirror/state': 6.1.4
+ '@lezer/highlight': 1.1.1
+ '@lezer/lr': 1.2.3
+ transitivePeerDependencies:
+ - '@codemirror/view'
+ - '@lezer/common'
+ dev: false
+
/@codemirror/language@6.2.1:
resolution: {integrity: sha512-MC3svxuvIj0MRpFlGHxLS6vPyIdbTr2KKPEW46kCoCXw2ktb4NTkpkPBI/lSP/FoNXLCBJ0mrnUi1OoZxtpW1Q==}
dependencies: