windmill-labs/windmill · error

Unsupported database type: ${dbType}

Error message

Unsupported database type: ${dbType}

What it means

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.

Source

Thrown at frontend/src/lib/components/apps/components/display/dbtable/utils.ts:351

		.join(', ')
}

export function renderDbQuotedIdentifier(identifier: string, dbType: DbType): string {
	switch (dbType) {
		case 'postgresql':
			return `"${identifier}"` // PostgreSQL uses double quotes for identifiers
		case 'ms_sql_server':
			return `[${identifier}]` // MSSQL uses square brackets for identifiers
		case 'mysql':
			return `\`${identifier}\`` // MySQL uses backticks
		case 'snowflake':
			return `"${identifier}"` // Snowflake uses double quotes for identifiers
		case 'bigquery':
			return `\`${identifier}\`` // BigQuery uses backticks
		case 'duckdb':
			return `"${identifier}"` // DuckDB uses double quotes for identifiers
		default:
			throw new Error('Unsupported database type: ' + dbType)
	}
}

export function getLanguageByResourceType(name: string): ScriptLang {
	const language = {
		postgresql: 'postgresql',
		mysql: 'mysql',
		ms_sql_server: 'mssql',
		mssql: 'mssql',
		snowflake: 'snowflake',
		snowflake_oauth: 'snowflake',
		bigquery: 'bigquery',
		duckdb: 'duckdb'
	}
	return language[name]
}

export function buildParameters(

View on GitHub (pinned to e474e8803c)

Solutions

  1. 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
  2. If you mapped a script language (e.g. getLanguageByResourceType output 'mssql') into this function, pass the original resource type instead
  3. Check the database resource type on the dbtable input is resolved (not undefined) before invoking DDL operations
  4. Add a case in utils.ts renderDbQuotedIdentifier if a genuinely new DbType needs identifier quoting

Example fix

// before
const quoted = renderDbQuotedIdentifier(field, lang) // lang = 'mssql' from getLanguageByResourceType
// after
const quoted = renderDbQuotedIdentifier(field, dbType) // 'ms_sql_server', the resource type
Defensive patterns

Strategy: type-guard

Validate before calling

function assertQuotableDbType(dbType) {
  const ok = ['postgresql','ms_sql_server','mysql','snowflake','bigquery','duckdb']
  if (!ok.includes(dbType)) throw new Error(`Cannot quote identifiers for db type: ${dbType}`)
}

Type guard

function isQuotableDbType(dbType: unknown): dbType is DbType {
  return typeof dbType === 'string' &&
    ['postgresql','ms_sql_server','mysql','snowflake','bigquery','duckdb'].includes(dbType)
}

Try / catch

try {
  const quoted = renderDbQuotedIdentifier(identifier, dbType)
} catch (e) {
  if (String(e.message).startsWith('Unsupported database type')) {
    console.error('Identifier quoting failed for dbType:', dbType)
    return identifier // or surface a user-facing error
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/59534ae2c85055a3. Report an issue: GitHub.