Skip to content

ToSqlParam for Geography: blocked on binary bind (needs text-format param bind) #133

@StefanSteiner

Description

@StefanSteiner

Summary

impl ToSqlParam for Geography (a sub-item of #65) is not implementable over
the current bind path
: Hyper has no PostgreSQL-binary input function for the
geography type, and query_params sends every parameter as PG binary
(format code 1, hardcoded). This issue tracks adding geography query-parameter
support once a text-format bind path exists.

Evidence (probed against hyperd 0.0.25080)

Binding a geography param via query_params was tried with three candidate
binary encodings — raw stored bytes (Geography::as_bytes), WKB
(Geography::to_wkb), and the HyperBinary [u32_le len][data] form
(ToHyperBinary). All three fail identically at Bind/Execute:

ERROR: no pg binary input function available for type geography (42883)

This is not an encoding bug — Hyper simply has no binary input decoder for
geography. Because the bind path is binary-only
(hyperdb-api-core/src/client/connection.rs:517, param_formats = vec![1; n]),
there is no byte sequence that makes a geography param work today.

What DID ship for geography in #65

The Inserter path (COPY / HyperBinary, a different channel) works fine, so
#65's commit added impl IntoValue for Geography + Inserter::add_geography,
verified by a round-trip test (raw bytes in → byte-identical out). Only the
query-parameter (ToSqlParam) direction is blocked.

Path to support

Same root cause and fix as #132 (scaled Numeric params): allow per-parameter
text-format bind
(format code 0) instead of the current uniform binary.
Geography has a text input function (WKT), so a text-bound geography param
($1 carrying WKT bytes, oid = geography) should parse. Requires plumbing
per-parameter format codes through start_execute_prepared / frontend::bind.

Acceptance criteria

  • A Geography can be passed to query_params and used in a predicate /
    projection (e.g. SELECT ST_Distance($1, g) FROM ...).
  • Round-trips correctly (WKT in → same geometry out).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions