feat(rds-data): typed-result fidelity for rich column types (batch 3)#2010
Merged
Conversation
ExecuteStatement now decodes Postgres NUMERIC, TIMESTAMP, TIMESTAMPTZ, DATE, TIME, UUID and JSON/JSONB columns into AWS `stringValue` fields, and MySQL DATE/DATETIME/TIME values into their canonical SQL text. Before this, those binary-format Postgres columns hit the fallback `String` decode, which fails for them and wrongly reported `isNull` — so a perfectly good numeric/timestamp/uuid/json value vanished from the result. tokio-postgres gains the with-chrono/with-uuid/with-serde_json features plus rust_decimal so the real values decode; timestamps render with Postgres's own trailing-zero-trimmed fractional-seconds rule. E2E test inserts NUMERIC/TIMESTAMP/UUID/JSONB and asserts each returns the expected stringValue against a real Postgres container.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch 3 of the RDS Data API (
rds-data). Closes the typed-result gap for non-scalar column types.Problem
ExecuteStatementdecoded BOOL/INT/FLOAT/BYTEA/text correctly, but every other Postgres column (NUMERIC, TIMESTAMP, TIMESTAMPTZ, DATE, TIME, UUID, JSON/JSONB) fell through to theStringdecode arm. Those columns use a binary wire format that does not decode asString, sotry_getfailed and the field was silently reported asisNull— a real value disappearing from the result set.Fix
rust_decimal::Decimal), TIMESTAMP/TIMESTAMPTZ/DATE/TIME (chrono), UUID (uuid), JSON/JSONB (serde_json::Value) and render each as AWSstringValue. Timestamps use Postgres's own canonical text (fractional seconds only when present, trailing zeros trimmed).Date/Timeprotocol values as canonical SQL text instead of the Rust debug form.tokio-postgresgainswith-chrono-0_4/with-uuid-1/with-serde_json-1; addsrust_decimal(db-tokio-postgres).Tests
New Docker-gated e2e (
rds_data_api_decodes_rich_column_types): inserts NUMERIC/TIMESTAMP/UUID/JSONB and asserts each comes back as the expectedstringValueagainst a real Postgres container. Passes locally; the existing typed-param and transaction tests still pass.Builds clean;
clippy --all-targets -D warningsclean; fmt clean.Summary by cubic
Fixes typed-result gaps in
rds-dataExecuteStatementby correctly decoding Postgres NUMERIC/TIMESTAMP/TIMESTAMPTZ/DATE/TIME/UUID/JSON(B) to AWSstringValue, and by rendering MySQL DATE/DATETIME/TIME as canonical SQL text. Prevents real values from collapsing toisNulland improves result fidelity.Bug Fixes
rust_decimal,chrono,uuid, andserde_json; timestamps use Postgres-style text with trimmed fractional seconds and timezone forTIMESTAMPTZ.DATE/DATETIME/TIME(includes sign and microseconds) instead of Rust debug forms.Stringdecode path that caused binary columns to returnisNull.Dependencies
tokio-postgresfeatures:with-chrono-0_4,with-uuid-1,with-serde_json-1.rust_decimal(featuredb-tokio-postgres), pluschronoanduuid.Written for commit 174f676. Summary will update on new commits.