Skip to content

Pg range types - #27

Merged
antialize merged 6 commits into
mainfrom
pg_range_types
Jul 19, 2026
Merged

antialize merged 6 commits into
mainfrom
pg_range_types

Conversation

@antialize

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class PostgreSQL range/multirange support to the type system and SQLx integration so queries involving range constructors, operators, and functions can be typed and (for supported element types) mapped to sqlx::postgres::types::PgRange.

Changes:

  • Extend qusql-type’s Type model + unification logic to represent and match Range(Box<Type>) and MultiRange(Box<Type>).
  • Implement typing for PostgreSQL range/multirange constructors, key operators, and several range-related functions (plus unnest(anymultirange) overload).
  • Add SQLx-side PgRange<T> bindings and tests for decoding/binding daterange, int4range, and multirange workflows.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
qusql-type/src/typer.rs Adds recursive type matching for Range/MultiRange.
qusql-type/src/type_reference.rs Extends table-function UNNEST typing to support multirange → range columns.
qusql-type/src/type_insert_replace.rs Tweaks insert/replace missing-column error formatting.
qusql-type/src/type_function.rs Adds typing for range/multirange constructors and functions; updates lower/upper/unnest overload behavior.
qusql-type/src/type_expression.rs Treats MultiRange as non-numeric for unary numeric operators.
qusql-type/src/type_binary_expression.rs Adds range/multirange handling for <</>> and certain user-defined operators.
qusql-type/src/type_.rs Refactors Type::Range to carry an element Type and introduces Type::MultiRange.
qusql-type/src/schema.rs Preserves int4 vs int8 element width when mapping parsed range subtypes into Type.
qusql-type/src/lib.rs Adds regression tests covering parsing/typing of range + multirange operators/functions.
qusql-sqlx-type/src/lib.rs Adds PgRange<T> argument/row bindings behind a postgres feature; re-exports PgRange.
qusql-sqlx-type/Cargo.toml Adds postgres feature and enables sqlx postgres support for dev-tests.
qusql-sqlx-type-test/src/test.rs Adds integration tests for daterange, int4range, and an int8multirange update + unnest() workflow.
qusql-sqlx-type-test/sqlx-type-schema.sql Extends test schema with daterange and int8multirange tables/columns.
qusql-sqlx-type-test/Cargo.toml Enables postgres/uuid support and adds chrono/uuid deps for new tests.
qusql-sqlx-type-macro/src/lib.rs Maps supported PostgreSQL range element types to qusql_sqlx_type::PgRange<...> in generated code.
qusql-py-mysql-type-plugin/src/lib.rs Treats MultiRange as Any for MySQL Python type plugin mapping.
qusql-parse/src/keywords.rs Adds PostgreSQL range-function keywords (isempty, lower_inc, etc.).
qusql-parse/src/function_expression.rs Parses new PostgreSQL range/multirange functions into dedicated Function variants.
qusql-mysql-type-macro/src/lib.rs Adds MultiRange placeholder handling (still todo!()) in MySQL macro mapping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread qusql-type/src/type_insert_replace.rs
Comment thread qusql-type/src/type_insert_replace.rs
Comment thread qusql-type/src/type_binary_expression.rs
Comment thread qusql-type/src/type_binary_expression.rs
Comment thread qusql-type/src/type_function.rs Outdated
Comment thread qusql-type/src/type_reference.rs
Comment thread qusql-sqlx-type-test/sqlx-type-schema.sql
@antialize
antialize merged commit dbf57d6 into main Jul 19, 2026
7 checks passed
@antialize
antialize deleted the pg_range_types branch July 19, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants