{"record":{"id":"272d7394afc8b693","repo":"windmill-labs/windmill","slug":"unsupported-database-type-272d73","errorCode":null,"errorMessage":"Unsupported database type","messagePattern":"Unsupported database type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/apps/components/display/dbtable/queries/insert.ts","lineNumber":31,"sourceCode":"import { buildParameters, ColumnIdentity } from '../utils'\nimport { getLanguageByResourceType, type ColumnDef } from '../utils'\n\nfunction formatInsertValues(columns: ColumnDef[], dbType: DbType, startIndex: number = 1): string {\n\tswitch (dbType) {\n\t\tcase 'mysql':\n\t\t\treturn columns.map((c) => `:${c.field}`).join(', ')\n\t\tcase 'postgresql':\n\t\t\treturn columns.map((c, i) => `$${startIndex + i}::${c.datatype}`).join(', ')\n\t\tcase 'ms_sql_server':\n\t\t\treturn columns.map((c, i) => `@p${startIndex + i}`).join(', ')\n\t\tcase 'snowflake':\n\t\t\treturn columns.map(() => `?`).join(', ')\n\t\tcase 'bigquery':\n\t\t\treturn columns.map((c) => `@${c.field}`).join(', ')\n\t\tcase 'duckdb':\n\t\t\treturn columns.map((c) => `$${c.field}`).join(', ')\n\t\tdefault:\n\t\t\tthrow new Error('Unsupported database type')\n\t}\n}\n\nfunction formatColumnNames(columns: ColumnDef[]): string {\n\treturn columns.map((c) => c.field).join(', ')\n}\n\nfunction getUserDefaultValue(column: ColumnDef) {\n\tif (column.defaultValueNull) {\n\t\treturn 'NULL'\n\t} else if (column.defaultUserValue) {\n\t\treturn typeof column.defaultUserValue === 'string'\n\t\t\t? `'${column.defaultUserValue}'`\n\t\t\t: column.defaultUserValue\n\t}\n}\n\nfunction formatDefaultValues(columns: ColumnDef[]): string {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/components/display/dbtable/queries/insert.ts#L13-L49","documentation":"formatInsertValues renders the VALUES(...) placeholder list for an INSERT, with per-database syntax (named params for mysql/duckdb, positional $n::type for postgres, @p for mssql, ? for snowflake, @field for bigquery). The default branch throws when dbType is unrecognized. This happens before any SQL is sent, so the error indicates a type the builder simply has no syntax for.","triggerScenarios":"makeInsertQuery called with a dbType outside mysql/postgresql/ms_sql_server/snowflake/bigquery/duckdb — typically an unmapped resource type or a newly added integration the legacy builder doesn't cover.","commonSituations":"Inserting via the legacy Database Studio table editor against a database resource of an unsupported/new type; ducklake input not normalized to 'duckdb'; typo in resourceType configuration.","solutions":["Confirm the resource's resourceType is one of the six handled kinds.","Normalize ducklake to 'duckdb' before building the insert query.","Add a case to formatInsertValues for the new dbType, or migrate the app to the Database Manager (WM_INTERNAL_DB) flow.","Print dbType in the error message locally while debugging to identify the exact value."],"exampleFix":"// before\nconst query = makeInsertQuery(table, columns, dbInput.resourceType)\n// after\nconst dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType\nconst query = makeInsertQuery(table, columns, dbType)","handlingStrategy":"validation","validationCode":"const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType\nif (!['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(dbType)) {\n  throw new Error(`Inserts unsupported for dbType \"${dbType}\"`)\n}\nconst query = makeInsertQuery(table, columns, dbType)","typeGuard":"function supportsInsert(t: string): t is DbType {\n  return ['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(t)\n}","tryCatchPattern":"try {\n  return getInsertInput(dbInput, table, columns)\n} catch (e) {\n  if (e instanceof Error && e.message === 'Unsupported database type') {\n    console.error('insert unsupported for', dbInput.resourceType)\n    return null\n  }\n  throw e\n}","preventionTips":["Map ducklake inputs to 'duckdb' (see getInsertInput) before building queries","Validate resourceType at app-config load time, not at insert time","Extend formatInsertValues whenever a new placeholder syntax is added","Migrate new features to the server-side WM_INTERNAL_DB builders"],"tags":["database","sql-generation","insert","unsupported-type"],"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"}