windmill-labs/windmill · error

Unsupported database type: ${dbType}

Error message

Unsupported database type: ${dbType}

What it means

renderAlterDatatype() renders the ALTER statement that changes a column's data type for the target database. It handles mysql, postgresql (implied earlier cases), snowflake and bigquery; any other DbType reaches the default branch and throws 'Unsupported database type'.

Source

Thrown at frontend/src/lib/components/apps/components/display/dbtable/queries/alterTable.ts:211

function renderAlterDatatype(
	tableRef: string,
	columnName: string,
	datatype: string,
	dbType: DbType
): string {
	switch (dbType) {
		case 'postgresql':
		case 'duckdb':
			return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} TYPE ${datatype};`
		case 'ms_sql_server':
			return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} ${datatype};`
		case 'mysql':
			return `ALTER TABLE ${tableRef} MODIFY COLUMN ${columnName} ${datatype};`
		case 'snowflake':
		case 'bigquery':
			return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} SET DATA TYPE ${datatype};`
		default:
			throw new Error(`Unsupported database type: ${dbType}`)
	}
}

function renderDropDefaultValue(
	tableRef: string,
	columnName: string,
	datatype: string,
	dbType: DbType,
	defaultConstraintName?: string
): string {
	switch (dbType) {
		case 'postgresql':
		case 'duckdb':
		case 'mysql':
		case 'snowflake':
		case 'bigquery':
			return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} DROP DEFAULT;`
		case 'ms_sql_server':

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check the connected resource's database type; if unhandled (e.g. ms_sql_server), change the datatype via manual SQL instead of the table editor.
  2. If developing: add a case for the missing dbType with its vendor-specific ALTER syntax.
  3. Confirm the resource type field matches a supported DbType value (no typos/custom values).
  4. Pre-validate in the UI: disable/hide datatype editing for dbTypes this renderer does not support.

Example fix

// before
default:
  throw new Error(`Unsupported database type: ${dbType}`)
// after
case 'ms_sql_server':
  return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} ${datatype};`
default:
  throw new Error(`Unsupported database type: ${dbType}`)
Defensive patterns

Strategy: validation

Validate before calling

const supportedDatatypeAlter = ['postgresql','mysql','snowflake','bigquery'] // plus whatever renderAlterDatatype covers
if (!supportedDatatypeAlter.includes(dbType)) {
  // disable datatype editing or fall back to manual SQL
}

Type guard

function supportsAlterDatatype(dbType: DbType): boolean {
  return ['postgresql','mysql','snowflake','bigquery'].includes(dbType)
}

Try / catch

try {
  return renderAlterDatatype(tableRef, columnName, datatype, dbType)
} catch (e) {
  if (String(e).includes('Unsupported database type')) {
    return fallbackManualSql(tableRef, columnName, datatype, dbType)
  }
  throw e
}

Prevention

When it happens

Trigger: Editing a column's datatype in the dbtable editor connected to a database whose dbType is not handled for datatype alters — e.g. ms_sql_server, duckdb, or any new DbType value added to the union without a case here.

Common situations: Using the table editor against MS SQL Server, where type changes require a different strategy; a newly supported database type in Windmill lacking an alter-datatype implementation; a dbType string mismatch (typo/custom value) coming from resource configuration.

Related errors


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