Ā© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
5 replies
BabaYaga

drizzle-zod doesn't work with Array in pg

I'm using
drizzle-orm
drizzle-orm
,
drizzle-kit
drizzle-kit
&
drizzle-zod
drizzle-zod
in my application. One of my schema looks like following:

export const committee = pgTable("committee", {
  id: text("id").primaryKey().notNull(),
  safety_health: text("safety_health"),
  safety_health_sources: text(
    "safety_health_sources"
  ).array(),
  // other properties
export const committee = pgTable("committee", {
  id: text("id").primaryKey().notNull(),
  safety_health: text("safety_health"),
  safety_health_sources: text(
    "safety_health_sources"
  ).array(),
  // other properties


The schema works fine when I push,
safety_health_sources
safety_health_sources
is created as an array (No issues till this point)

I create
zod
zod
schema as well, like following:

export const committeeSchema = createSelectSchema(committee);
export const committeeSchema = createSelectSchema(committee);

and when I do:

type Committee = Partial<
  z.infer<typeof committeeSchema>
>;
// the type become something like following
type Committee = {
    id?: string | undefined;
    safety_health?: string | null | undefined;
    safety_health_sources?: string | null | undefined; // <--- The problem is here, it should be an Array<string>
    // other properties
}
type Committee = Partial<
  z.infer<typeof committeeSchema>
>;
// the type become something like following
type Committee = {
    id?: string | undefined;
    safety_health?: string | null | undefined;
    safety_health_sources?: string | null | undefined; // <--- The problem is here, it should be an Array<string>
    // other properties
}
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

PG Array and drizzle-zod issues
Drizzle TeamDTDrizzle Team / help
3y ago
generate:pg doesn't create pgEnums
Drizzle TeamDTDrizzle Team / help
3y ago
Query in drizzle doesn't work
Drizzle TeamDTDrizzle Team / help
3y ago
Drizzle-zod not inferring array field as array
Drizzle TeamDTDrizzle Team / help
2y ago