windmill-labs/windmill · error

Unsupported database type

Error message

Unsupported database type

What it means

makeDeleteQuery builds a frontend DELETE statement and switches on dbType to choose parameter placeholders and identity-column handling. The default branch throws 'Unsupported database type' when dbType is not one of the explicitly supported database kinds. It prevents generating a DELETE query with placeholder syntax the target database cannot parse.

Source

Thrown at frontend/src/lib/components/apps/components/display/dbtable/queries/delete.ts:74

		case 'bigquery': {
			const conditions = columns
				.map(
					(c, i) =>
						`(CAST(@${c.field} AS STRING) = 'null' AND ${c.field} IS NULL OR ${c.field} = @${c.field})`
				)
				.join('\n    AND ')
			query += `\nDELETE FROM ${table} \nWHERE ${conditions}`
			return query
		}
		case 'duckdb': {
			const conditions = columns
				.map((c) => `($${c.field} IS NULL AND ${c.field} IS NULL OR ${c.field} = $${c.field})`)
				.join('\n    AND ')
			query += `\nDELETE FROM ${table} \nWHERE ${conditions}`
			return query
		}
		default:
			throw new Error('Unsupported database type')
	}
}

export function getDeleteInput(
	dbInput: DbInput,
	table: string,
	columns: ColumnDef[]
): AppInput | undefined {
	if (
		(dbInput.type == 'ducklake' && !dbInput.ducklake) ||
		(dbInput.type == 'database' && !dbInput.resourcePath) ||
		!table
	) {
		return undefined
	}
	const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType
	let query = makeDeleteQuery(table, columns, dbType)
	if (dbInput.type === 'ducklake') query = wrapDucklakeQuery(query, dbInput.ducklake)

View on GitHub (pinned to e474e8803c)

Solutions

  1. Verify the database resource's resourceType is one supported by the delete builder's switch.
  2. Map ducklake inputs to 'duckdb' before calling (as getDeleteInput-style wrappers do).
  3. Extend the switch with the new dbType's placeholder syntax if you own the code that added the new integration.
  4. Prefer the newer Database Manager path (WM_INTERNAL_DB markers expanded server-side) over this legacy frontend builder.

Example fix

// before
const q = makeDeleteQuery(table, pkColumns, dbInput.resourceType)
// after
const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType
const q = makeDeleteQuery(table, pkColumns, dbType)
Defensive patterns

Strategy: validation

Validate before calling

const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType
if (!['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(dbType)) {
  return null // delete not supported for this database
}

Type guard

const isDeletableDbType = (t: unknown): t is DbType =>
  typeof t === 'string' && ['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(t)

Try / catch

try {
  return makeDeleteQuery(table, pkColumns, dbType)
} catch (e) {
  if (e instanceof Error && e.message === 'Unsupported database type') {
    showToast('Deletes are not supported for this database type')
    return null
  }
  throw e
}

Prevention

When it happens

Trigger: Calling makeDeleteQuery with a dbType other than mysql, postgresql, ms_sql_server, snowflake, bigquery, or duckdb — e.g. a resource type added later that this builder predates, an unmapped 'ducklake' input, or corrupted saved app state with an unknown type string.

Common situations: New DB integration added to the platform without updating this legacy builder; database resource configured with an unexpected/renamed resourceType; legacy Database Studio app pointed at a resource type it was never built for.

Related errors


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