{"record":{"id":"451017333a026a73","repo":"windmill-labs/windmill","slug":"unsupported-database-type-dbtype-451017","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/queries/relationalKeys.ts","lineNumber":56,"sourceCode":"\tconst tableParts = table.split('.')\n\tconst tableName = tableParts[tableParts.length - 1]\n\tconst schemaName = tableParts.length > 1 ? tableParts[0] : defaultSchema\n\n\tswitch (dbType) {\n\t\tcase 'postgresql':\n\t\t\treturn makePostgresForeignKeysQuery(tableName, schemaName || 'public')\n\t\tcase 'mysql':\n\t\t\treturn makeMysqlForeignKeysQuery(tableName, schemaName || '')\n\t\tcase 'ms_sql_server':\n\t\t\treturn makeMsSqlForeignKeysQuery(tableName, schemaName || 'dbo')\n\t\tcase 'snowflake':\n\t\t\treturn makeSnowflakeForeignKeysQuery(tableName, schemaName || 'PUBLIC')\n\t\tcase 'bigquery':\n\t\t\treturn makeBigQueryForeignKeysQuery(tableName, schemaName)\n\t\tcase 'duckdb':\n\t\t\treturn makeDuckDbForeignKeysQuery(tableName, schemaName || 'main')\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported database type: ${dbType}`)\n\t}\n}\n\n/**\n * Generates SQL query to fetch primary key constraint name for a specific table\n * @param dbType - The database type\n * @param table - The table name (can include schema, e.g., \"schema.table\")\n * @param defaultSchema - The default schema to use when table doesn't include one\n * @returns SQL query string\n */\nexport function makePrimaryKeyConstraintQuery(\n\tdbType: DbType,\n\ttable: string,\n\tdefaultSchema?: string\n): string {\n\tconst tableParts = table.split('.')\n\tconst tableName = tableParts[tableParts.length - 1]\n\tconst schemaName = tableParts.length > 1 ? tableParts[0] : defaultSchema","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/components/display/dbtable/queries/relationalKeys.ts#L38-L74","documentation":"makeForeignKeysQuery generates the catalog query used to list foreign keys for a table, with a dedicated variant per supported database (including information_schema queries for postgres/mysql, and specific helpers for snowflake, bigquery, duckdb). The default branch throws with the offending dbType when no variant exists. BigQuery genuinely lacks foreign-key metadata, so unsupported types are rejected rather than producing broken SQL.","triggerScenarios":"Calling fkQuery/makeForeignKeysQuery with a dbType outside the switch (mysql, postgresql, ms_sql_server, snowflake, bigquery, duckdb, …) — e.g. an exotic resource type, an unmapped alias, or a type added after this builder was written.","commonSituations":"Opening the relations/foreign-keys panel of the dbtable against an unsupported database resource; resourceType typo in app config; new integration not yet supported by the relational-keys feature.","solutions":["Check the resource's resourceType and use a supported database for schema exploration.","Normalize ducklake to 'duckdb' before the call.","Add a make<Db>ForeignKeysQuery case if the new database exposes FK metadata.","Hide/disable the FK panel for unsupported dbTypes in the UI instead of calling the builder."],"exampleFix":"// before\nconst q = makeForeignKeysQuery(dbType, table, schema)\n// after\nconst SUPPORTED_FK = ['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb']\nif (!SUPPORTED_FK.includes(dbType)) return null // render 'relations unsupported' state\nconst q = makeForeignKeysQuery(dbType, table, schema)","handlingStrategy":"validation","validationCode":"const FK_SUPPORTED = ['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb']\nconst dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType\nif (!FK_SUPPORTED.includes(dbType)) {\n  return null // render 'relations not available' instead of querying\n}","typeGuard":"const supportsForeignKeys = (t: unknown): t is DbType =>\n  typeof t === 'string' && ['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(t)","tryCatchPattern":"try {\n  const q = makeForeignKeysQuery(dbType, table, schema)\n} catch (e) {\n  if (String(e?.message).startsWith('Unsupported database type')) {\n    setRelationsUnavailable(true)\n    return\n  }\n  throw e\n}","preventionTips":["Gate the FK/relations panel on a supported-datatype check","Normalize ducklake to 'duckdb' upstream","For bigquery remember schemaName is mandatory (no default fallback)","Update relationalKeys.ts switches when adding new integrations"],"tags":["database","foreign-keys","metadata","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"}