Skip to content

1.15.0 — custom PostgreSQL column types

Choose a tag to compare

@vsdudakov vsdudakov released this 16 Jul 08:25
· 12 commits to main since this release

Feature release: custom PostgreSQL column types (pgvector vector, inet, citext, ...) now work end-to-end through the ORM. Highlights:

Added

  • yara_orm.RawText: a thin str subclass that binds as an untyped text parameter on PostgreSQL — the server infers the type from context (target column, <=> operand) and parses the text through the type's own input function. Custom field kinds return it from to_db; previously every ORM INSERT/UPDATE into such a column failed with SQLSTATE 42804 unless the database installed a global CREATE CAST (text AS ...) WITH INOUT AS IMPLICIT. On every other backend it binds like a plain string.
  • Field.select_as_text: PostgreSQL SELECT/RETURNING projections read the column through CAST(col AS text) and to_python parses the text form — previously selecting a custom-typed column raised unsupported PostgreSQL type OID, forcing .defer() workarounds. Applied at every projection site (full-row, only()/defer(), select_related, values(), m2m prefetch, RETURNING) via the new BaseDialect.select_column hook; comparisons and grouping keep the column's real type.
  • The custom-fields guide documents both on a complete pgvector VectorField example.

Full details in CHANGELOG.md.