windmill-labs/windmill · error

Unsupported database type

Error message

Unsupported database type

What it means

makeSelectQuery builds frontend-side SELECT SQL for the dbtable/Database Studio component and only supports postgresql, mysql, ms_sql_server, snowflake, bigquery and duckdb. If the dbType falls outside the switch (e.g. an undefined, renamed or not-yet-supported database type), the default arm throws 'Unsupported database type'. It is a configuration/dbType-guard, not a SQL error.

Source

Thrown at frontend/src/lib/components/apps/components/display/dbtable/queries/select.ts:319

      (CASE WHEN $order_by = '${column.field}' AND $is_desc IS false THEN "${column.field}"::text END),
      (CASE WHEN $order_by = '${column.field}' AND $is_desc IS true THEN "${column.field}"::text END) DESC`
				)
				.join(',\n')}`

			quicksearchCondition = `($quicksearch = '' OR CONCAT(${duckdbQuicksearchColumns(
				columnDefs
			)}) ILIKE '%' || $quicksearch || '%')`

			query += `SELECT ${filteredColumns.join(', ')} FROM ${table}\n`
			query += ` WHERE ${whereClause ? `${whereClause} AND` : ''} ${quicksearchCondition}\n`
			query += ` ORDER BY ${orderBy}\n`
			query += ` LIMIT $limit::INT OFFSET $offset::INT`

			break
		}

		default:
			throw new Error('Unsupported database type')
	}

	return query
}

function coerceToNumber(value: any): number {
	if (typeof value === 'number') {
		return value
	}
	if (typeof value === 'string') {
		return parseInt(value, 10)
	}
	return 0
}

export function getSelectInput(
	dbInput: DbInput,
	table: string | undefined,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check the database input's resource type and switch to one of the supported types: postgresql, mysql, ms_sql_server, snowflake, bigquery, duckdb
  2. Log/inspect the dbType value passed to makeSelectQuery — undefined usually means the DbInput failed to resolve; fix the component's database input binding
  3. If a legitimately new backend DbType is missing, add a case to the switch in frontend/src/lib/components/apps/components/display/dbtable/queries/select.ts or migrate the app to the Database Manager (WM_INTERNAL_DB) path
  4. Redeploy the app after changing the resource so the generated policy and queries are rebuilt

Example fix

// before
makeSelectQuery(table, columnDefs, where, options, dbType as DbType) // dbType may be undefined
// after
const supported = ['postgresql','mysql','ms_sql_server','snowflake','bigquery','duckdb']
if (!supported.includes(dbType)) throw new Error(`dbType '${dbType}' not supported by dbtable select`)
makeSelectQuery(table, columnDefs, where, options, dbType)
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['postgresql','mysql','ms_sql_server','snowflake','bigquery','duckdb']
if (!SUPPORTED.includes(dbType)) {
  throw new Error(`dbtable select does not support database type: ${dbType}`)
}

Type guard

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

Try / catch

try {
  const sql = makeSelectQuery(table, columnDefs, where, options, dbType)
} catch (e) {
  if (e.message === 'Unsupported database type') {
    showToast(`Database type '${dbType}' is not supported for table display`, true)
  } else throw e
}

Prevention

When it happens

Trigger: Calling makeSelectQuery(table, columns, where, options, dbType) with a dbType that is not one of the six handled cases — typically dbType being undefined because the DbInput resource type was not resolved, or a newly added DbType (e.g. ducklake variants) that lacks a frontend case.

Common situations: A Database Studio app whose database resource type is new/exotic and has no frontend select builder; dbType derived from a resource that returns an unexpected string; upgrading Windmill where a new DbType was introduced before frontend support; a component wired with a stale/empty DbInput.

Related errors


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