{"id":"f5a05442155b576b","repo":"drizzle-team/drizzle-orm","slug":"for-now-you-can-t-specify-generators-for-columns-o","errorCode":null,"errorMessage":"for now you can't specify generators for columns of dimension greater than 1.","messagePattern":"for now you can't specify generators for columns of dimension greater than 1\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-seed/src/services/SeedService.ts","lineNumber":196,"sourceCode":"\t\t\t\t\twasDefinedBefore: false,\n\t\t\t\t\twasRefined: false,\n\t\t\t\t};\n\n\t\t\t\tif (\n\t\t\t\t\trefinements !== undefined\n\t\t\t\t\t&& refinements[table.name] !== undefined\n\t\t\t\t\t&& refinements[table.name]!.columns !== undefined\n\t\t\t\t\t&& refinements[table.name]!.columns[col.name] !== undefined\n\t\t\t\t) {\n\t\t\t\t\tconst genObj = refinements[table.name]!.columns[col.name]!;\n\n\t\t\t\t\tif (col.columnType.match(/\\[\\w*]/g) !== null) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(col.baseColumn?.dataType === 'array' && col.baseColumn.columnType.match(/\\[\\w*]/g) !== null)\n\t\t\t\t\t\t\t// studio case\n\t\t\t\t\t\t\t|| (col.typeParams.dimensions !== undefined && col.typeParams.dimensions > 1)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error(\"for now you can't specify generators for columns of dimension greater than 1.\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgenObj.baseColumnDataType = col.baseColumn?.dataType;\n\t\t\t\t\t}\n\n\t\t\t\t\tcolumnPossibleGenerator.generator = genObj;\n\t\t\t\t\tcolumnPossibleGenerator.wasRefined = true;\n\t\t\t\t} else if (Object.hasOwn(foreignKeyColumns, col.name)) {\n\t\t\t\t\t// TODO: I might need to assign repeatedValuesCount to column there instead of doing so in generateTablesValues\n\t\t\t\t\tconst cyclicRelation = relations.find((rel) =>\n\t\t\t\t\t\trel.table === table.name\n\t\t\t\t\t\t&& rel.isCyclic === true\n\t\t\t\t\t\t&& rel.columns.includes(col.name)\n\t\t\t\t\t);\n\n\t\t\t\t\tif (cyclicRelation !== undefined) {\n\t\t\t\t\t\tcolumnPossibleGenerator.isCyclic = true;\n\t\t\t\t\t}","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-seed/src/services/SeedService.ts#L178-L214","documentation":"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.","triggerScenarios":"Defining a multi-dimensional Postgres array column like integer[][] or text[][] and specifying a generator for it in refinements.columns.","commonSituations":"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.","solutions":["Reduce the column to a single-dimensional array (text[], integer[]) which is supported.","Remove the refinement for the multi-dimensional column and let it default to null.","Model the nested data as a separate related table instead of a multi-dimensional array column."],"exampleFix":"// before\ntags: integer('tags').array().array()  // dimensions = 2\n// refinements: { myTable: { columns: { tags: { generator: ... } } } }\n// after — use a single-dimension array or a related table\ntags: integer('tags').array()","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Guard: reject multi-dimensional array columns before seeding.\nfunction isMultiDimensionalArray(col: { columnType: string; typeParams?: { dimensions?: number } }): boolean {\n  const isArray = col.columnType.match(/\\[\\w*\\]/) !== null;\n  const dims = col.typeParams?.dimensions ?? 1;\n  return isArray && dims > 1;\n}\n// Skip seeding or set to null if true.","tryCatchPattern":null,"preventionTips":["Avoid multi-dimensional Postgres array columns in schemas that need seeding.","Model nested collections as related tables instead.","If multi-D arrays are unavoidable, exclude them from refinements so they default to null."],"tags":["array","multi-dimensional","postgres","refinements"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}