Skip to content

Commit 0a33b74

Browse files
committed
docs: document JSONB literals work without explicit type casts
Add notes to searchable-json.md clarifying that JSONB literals in INSERT, UPDATE, and containment operations work directly without ::jsonb type annotations. The proxy infers the JSONB type from the target column. Also adds docstring to map_jsonb integration test explaining the intentional absence of type casts.
1 parent 63631d0 commit 0a33b74

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

docs/reference/searchable-json.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ SELECT eql_v2.add_search_config(
4343
);
4444
```
4545

46+
> **Note:** JSONB literals in INSERT and UPDATE statements work directly without explicit `::jsonb` type casts. The proxy infers the JSONB type from the target column and handles encryption transparently.
47+
4648
### JSON document structure
4749

4850
Examples assume an encrypted JSON document with the following structure:
@@ -591,6 +593,8 @@ SELECT jsonb_array_length(jsonb_path_query(encrypted_jsonb, '$.unknown')) FROM c
591593

592594
## Containment Operators
593595

596+
> **Note:** Containment operators work directly with JSONB literals without requiring explicit `::jsonb` type casts. The examples below use the simplified syntax intentionally.
597+
594598
### `@>` (Contains Operator)
595599

596600
Tests whether the left JSONB value contains the right JSONB value.

packages/cipherstash-proxy-integration/src/map_literals.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ mod tests {
4545
println!("encrypted: {:?}", rows[0])
4646
}
4747

48+
/// Verify JSONB literal insertion and retrieval without explicit type casts.
49+
///
50+
/// JSONB literals in INSERT and SELECT statements work directly with the proxy
51+
/// without requiring `::jsonb` type annotations. The proxy infers the JSONB type
52+
/// from the target column and handles encryption/decryption transparently.
4853
#[tokio::test]
4954
async fn map_jsonb() {
5055
trace();

0 commit comments

Comments
 (0)