You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PostgreSQL bytea columns (OID 17) are now decoded from hex format into
`Array[U8] val` instead of being returned as raw hex strings. Only hex
format is supported (the default since PostgreSQL 9.0).
The `FieldDataTypes` union gains `Array[U8] val` as a ninth variant.
Existing code is unaffected — Pony's match is non-exhaustive, so code
without a bytea arm continues to work.
`Field.eq()` implements element-by-element comparison for byte arrays
since Pony's `Array` uses identity comparison by default.
Design: #118
PostgreSQL `bytea` columns are now automatically decoded from hex format into `Array[U8] val`. Previously, bytea values were returned as raw hex strings (e.g., `\x48656c6c6f`). They are now decoded into byte arrays that you can work with directly.
4
+
5
+
```pony
6
+
be pg_query_result(session: Session, result: Result) =>
Existing code is unaffected — if your `match` on `field.value` doesn't include an `Array[U8] val` arm, bytea values simply won't match any branch (Pony's match is non-exhaustive).
-`TransactionStatus` — union type `(TransactionIdle | TransactionInBlock | TransactionFailed)`. Reported via `pg_transaction_status` callback on every `ReadyForQuery`.
103
103
-`Notification` — val class wrapping channel name, payload string, and notifying backend's process ID. Delivered via `pg_notification` callback.
104
104
-`NoticeResponseMessage` — non-fatal PostgreSQL notice with all standard fields (same structure as `ErrorResponseMessage`). Delivered via `pg_notice` callback.
@@ -117,6 +117,7 @@ Only one operation is in-flight at a time. The queue serializes execution. `quer
@@ -145,6 +146,8 @@ Tests live in the main `postgres/` package (private test classes), organized acr
145
146
-`_TestPrepareShutdownDrainsPrepareQueue` — uses a local TCP listener that auto-auths but never becomes ready; verifies pending prepare operations get `SessionClosed` failures on shutdown
146
147
-`_TestTerminateSentOnClose` — mock server fully authenticates and becomes ready; verifies that closing the session sends a Terminate message ('X') to the server
147
148
-`_TestZeroRowSelectReturnsResultSet` — mock server sends RowDescription + CommandComplete("SELECT 0") with no DataRows; verifies ResultSet (not RowModifying) with zero rows
149
+
-`_TestByteaResultDecoding` — mock server sends RowDescription (bytea column, OID 17) + DataRow with hex-encoded value + CommandComplete; verifies field value is `Array[U8] val` with correct decoded bytes
150
+
-`_TestEmptyByteaResultDecoding` — mock server sends DataRow with empty bytea (`\x`); verifies empty `Array[U8] val`
148
151
149
152
**`_test_ssl.pony`** — SSL negotiation unit tests (mock servers) and SSL integration tests:
150
153
-`_TestSSLNegotiationRefused` — mock server responds 'N' to SSLRequest; verifies `pg_session_connection_failed` fires
@@ -167,7 +170,7 @@ Tests live in the main `postgres/` package (private test classes), organized acr
Copy file name to clipboardExpand all lines: examples/README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
Each subdirectory is a self-contained Pony program demonstrating a different part of the postgres library.
4
4
5
+
## bytea
6
+
7
+
Binary data using `bytea` columns. Executes a SELECT that returns a bytea value, matches on `Array[U8] val` in the result, and prints the decoded bytes. Shows how the driver automatically decodes PostgreSQL's hex-format bytea representation into raw byte arrays.
8
+
5
9
## query
6
10
7
11
Minimal example using `SimpleQuery`. Connects, authenticates, executes `SELECT 525600::text`, and prints the result by iterating rows and matching on `FieldDataTypes`. Start here if you're new to the library.
0 commit comments