diff --git a/packages/sqltree/src/dumpSqlCommand.ts b/packages/sqltree/src/dumpSqlCommand.ts index 0c3f2c66..d73d7d69 100644 --- a/packages/sqltree/src/dumpSqlCommand.ts +++ b/packages/sqltree/src/dumpSqlCommand.ts @@ -87,7 +87,7 @@ export function dumpSqlDelete(dmp: SqlDumper, cmd: Delete) { if (cmd.alterTableDeleteSyntax) { dmp.put('^alter ^table '); dumpSqlSourceRef(dmp, cmd.from); - dmp.put('^delete '); + dmp.put(' ^delete '); } else { dmp.put('^delete ^from '); dumpSqlSourceRef(dmp, cmd.from); diff --git a/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js b/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js index d2c5c8c0..91118d28 100644 --- a/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js +++ b/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js @@ -44,8 +44,12 @@ class Analyser extends DatabaseAnalyser { ...col, ...extractDataType(col.dataType), })), - primaryKey: { columns: (table.primaryKeyColumns || '').split(',').map((columnName) => ({ columnName })) }, - sortingKey: { columns: (table.sortingKeyColumns || '').split(',').map((columnName) => ({ columnName })) }, + primaryKey: table.primaryKeyColumns + ? { columns: (table.primaryKeyColumns || '').split(',').map((columnName) => ({ columnName })) } + : null, + sortingKey: table.sortingKeyColumns + ? { columns: (table.sortingKeyColumns || '').split(',').map((columnName) => ({ columnName })) } + : null, foreignKeys: [], })), };