drizzle-team/drizzle-orm · error · Error

for now you can't specify generators for columns of dimensio

Error message

for now you can't specify generators for columns of dimension greater than 1.

What it means

When a refined column has an array type (e.g. text[] in Postgres), drizzle-seed inspects its dimensions. If the base column is itself an array (nested array) or typeParams.dimensions > 1, the library cannot apply a per-element generator and throws. Multi-dimensional array generation is not implemented.

Source

Thrown at drizzle-seed/src/services/SeedService.ts:196

					wasDefinedBefore: false,
					wasRefined: false,
				};

				if (
					refinements !== undefined
					&& refinements[table.name] !== undefined
					&& refinements[table.name]!.columns !== undefined
					&& refinements[table.name]!.columns[col.name] !== undefined
				) {
					const genObj = refinements[table.name]!.columns[col.name]!;

					if (col.columnType.match(/\[\w*]/g) !== null) {
						if (
							(col.baseColumn?.dataType === 'array' && col.baseColumn.columnType.match(/\[\w*]/g) !== null)
							// studio case
							|| (col.typeParams.dimensions !== undefined && col.typeParams.dimensions > 1)
						) {
							throw new Error("for now you can't specify generators for columns of dimension greater than 1.");
						}

						genObj.baseColumnDataType = col.baseColumn?.dataType;
					}

					columnPossibleGenerator.generator = genObj;
					columnPossibleGenerator.wasRefined = true;
				} else if (Object.hasOwn(foreignKeyColumns, col.name)) {
					// TODO: I might need to assign repeatedValuesCount to column there instead of doing so in generateTablesValues
					const cyclicRelation = relations.find((rel) =>
						rel.table === table.name
						&& rel.isCyclic === true
						&& rel.columns.includes(col.name)
					);

					if (cyclicRelation !== undefined) {
						columnPossibleGenerator.isCyclic = true;
					}

View on GitHub (pinned to b7862528fd)

Solutions

  1. Reduce the column to a single-dimensional array (text[], integer[]) which is supported.
  2. Remove the refinement for the multi-dimensional column and let it default to null.
  3. Model the nested data as a separate related table instead of a multi-dimensional array column.

Example fix

// before
tags: integer('tags').array().array()  // dimensions = 2
// refinements: { myTable: { columns: { tags: { generator: ... } } } }
// after — use a single-dimension array or a related table
tags: integer('tags').array()
Defensive patterns

Strategy: type-guard

Type guard

// Guard: reject multi-dimensional array columns before seeding.
function isMultiDimensionalArray(col: { columnType: string; typeParams?: { dimensions?: number } }): boolean {
  const isArray = col.columnType.match(/\[\w*\]/) !== null;
  const dims = col.typeParams?.dimensions ?? 1;
  return isArray && dims > 1;
}
// Skip seeding or set to null if true.

Prevention

When it happens

Trigger: Defining a multi-dimensional Postgres array column like integer[][] or text[][] and specifying a generator for it in refinements.columns.

Common situations: Using nested Postgres array types in a schema and attempting to seed them with drizzle-seed; upgrading a schema from 1-D to multi-D arrays without removing the refinement.

Related errors


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/f5a05442155b576b.json. Report an issue: GitHub.