{"record":{"id":"59534ae2c85055a3","repo":"windmill-labs/windmill","slug":"unsupported-database-type-dbtype-59534a","errorCode":null,"errorMessage":"Unsupported database type: ${dbType}","messagePattern":"Unsupported database type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/apps/components/display/dbtable/utils.ts","lineNumber":351,"sourceCode":"\t\t.join(', ')\n}\n\nexport function renderDbQuotedIdentifier(identifier: string, dbType: DbType): string {\n\tswitch (dbType) {\n\t\tcase 'postgresql':\n\t\t\treturn `\"${identifier}\"` // PostgreSQL uses double quotes for identifiers\n\t\tcase 'ms_sql_server':\n\t\t\treturn `[${identifier}]` // MSSQL uses square brackets for identifiers\n\t\tcase 'mysql':\n\t\t\treturn `\\`${identifier}\\`` // MySQL uses backticks\n\t\tcase 'snowflake':\n\t\t\treturn `\"${identifier}\"` // Snowflake uses double quotes for identifiers\n\t\tcase 'bigquery':\n\t\t\treturn `\\`${identifier}\\`` // BigQuery uses backticks\n\t\tcase 'duckdb':\n\t\t\treturn `\"${identifier}\"` // DuckDB uses double quotes for identifiers\n\t\tdefault:\n\t\t\tthrow new Error('Unsupported database type: ' + dbType)\n\t}\n}\n\nexport function getLanguageByResourceType(name: string): ScriptLang {\n\tconst language = {\n\t\tpostgresql: 'postgresql',\n\t\tmysql: 'mysql',\n\t\tms_sql_server: 'mssql',\n\t\tmssql: 'mssql',\n\t\tsnowflake: 'snowflake',\n\t\tsnowflake_oauth: 'snowflake',\n\t\tbigquery: 'bigquery',\n\t\tduckdb: 'duckdb'\n\t}\n\treturn language[name]\n}\n\nexport function buildParameters(","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/components/display/dbtable/utils.ts#L333-L369","documentation":"renderDbQuotedIdentifier quotes a SQL identifier with the correct quoting style per database (double quotes for postgresql/snowflake/duckdb, brackets for MSSQL, backticks for mysql/bigquery). An unknown dbType hits the default arm and throws 'Unsupported database type: <dbType>'. Unlike the query builders, it includes the offending value in the message, which usually reveals the misconfiguration.","triggerScenarios":"Calling renderDbQuotedIdentifier(identifier, dbType) with any dbType other than the six handled literals — e.g. passing a raw resource type like 'snowflake_oauth', a language name like 'mssql' instead of 'ms_sql_server', or undefined when the db input failed to resolve. Called by makeAlterTableQueries, renderDropDefaultValue, renderDropForeignKey, renderDropPrimaryKey, targetRef and buildVisibleFieldList, so any alter-table/DDL operation in the dbtable component on an unhandled type throws.","commonSituations":"Running an alter table / drop default / drop key operation in Database Studio against a database whose type string doesn't exactly match the switch literals; passing the script language ('mssql') instead of the resource type ('ms_sql_server'); a new DbType added without updating this util.","solutions":["Print the dbType in the error message ('Unsupported database type: X') and correct it to one of: postgresql, ms_sql_server, mysql, snowflake, bigquery, duckdb","If you mapped a script language (e.g. getLanguageByResourceType output 'mssql') into this function, pass the original resource type instead","Check the database resource type on the dbtable input is resolved (not undefined) before invoking DDL operations","Add a case in utils.ts renderDbQuotedIdentifier if a genuinely new DbType needs identifier quoting"],"exampleFix":"// before\nconst quoted = renderDbQuotedIdentifier(field, lang) // lang = 'mssql' from getLanguageByResourceType\n// after\nconst quoted = renderDbQuotedIdentifier(field, dbType) // 'ms_sql_server', the resource type","handlingStrategy":"type-guard","validationCode":"function assertQuotableDbType(dbType) {\n  const ok = ['postgresql','ms_sql_server','mysql','snowflake','bigquery','duckdb']\n  if (!ok.includes(dbType)) throw new Error(`Cannot quote identifiers for db type: ${dbType}`)\n}","typeGuard":"function isQuotableDbType(dbType: unknown): dbType is DbType {\n  return typeof dbType === 'string' &&\n    ['postgresql','ms_sql_server','mysql','snowflake','bigquery','duckdb'].includes(dbType)\n}","tryCatchPattern":"try {\n  const quoted = renderDbQuotedIdentifier(identifier, dbType)\n} catch (e) {\n  if (String(e.message).startsWith('Unsupported database type')) {\n    console.error('Identifier quoting failed for dbType:', dbType)\n    return identifier // or surface a user-facing error\n  }\n  throw e\n}","preventionTips":["Pass the resource type (ms_sql_server), never the script language (mssql), into this function","Resolve dbType from the DbInput before any DDL operation and fail fast if undefined","Add a case for every new DbType in the same commit that introduces it","Centralize the DbType literal union and reuse it in all switches so the compiler flags missing arms"],"tags":["database","sql-identifier","quoting","dbtable","frontend"],"backgroundTag":"unsupported-database-type","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}