drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

feat(orm): allow customType selectFromDb SQL transforms

Open TheDerbiedOne opened this issue 6 months ago • 0 comments

Addresses drizzle-team/drizzle-orm#1083.

Summary

This PR adds a new optional selectFromDb hook to customType(...), allowing custom columns to customize how they are selected from the database before driver decoding.

This is useful for custom types that require SQL-level transformation when selected, such as PostGIS geometries.

Changes

  • Adds selectFromDb to custom type params across supported dialects.
  • Uses selectFromDb during select query generation.
  • Adds a test covering custom select SQL generation.
  • Updates custom type documentation.

Verification

Ran:

npx -y [email protected] -C drizzle-orm test -- --run customTypeSelectFromDb

TheDerbiedOne avatar May 22 '26 03:05 TheDerbiedOne