Skip to content

Commit 7a1d46d

Browse files
committed
docs(operators): clarify ->> alias semantics
1 parent f4ea5ec commit 7a1d46d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/operators/->>.sql

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
-- REQUIRE: src/encrypted/types.sql
33
-- REQUIRE: src/encrypted/functions.sql
44

5-
--! @brief JSONB field accessor operator returning text (->>)
5+
--! @brief JSONB field accessor operator alias (->>)
66
--!
7-
--! Implements the ->> operator to access fields/elements from encrypted JSONB data,
8-
--! returning the result as text (still encrypted). Text-returning version of -> operator.
7+
--! Implements the ->> operator as an alias of -> for encrypted JSONB data. This mirrors
8+
--! PostgreSQL semantics where ->> returns text via implicit casts. The underlying
9+
--! implementation delegates to eql_v2."->" and allows PostgreSQL to coerce the result.
910
--!
1011
--! Provides two overloads:
1112
--! - (eql_v2_encrypted, text) - Field name selector
@@ -17,7 +18,7 @@
1718
--! @brief ->> operator with text selector
1819
--! @param e eql_v2_encrypted Encrypted JSONB data
1920
--! @param selector text Field name to extract
20-
--! @return text Encrypted value at selector as text
21+
--! @return text Encrypted value at selector, implicitly cast from eql_v2_encrypted
2122
--! @example
2223
--! SELECT encrypted_json ->> 'field_name' FROM table;
2324
CREATE FUNCTION eql_v2."->>"(e eql_v2_encrypted, selector text)
@@ -47,7 +48,7 @@ CREATE OPERATOR ->> (
4748
--! @brief ->> operator with encrypted selector
4849
--! @param e eql_v2_encrypted Encrypted JSONB data
4950
--! @param selector eql_v2_encrypted Encrypted field selector
50-
--! @return text Encrypted value at selector as text
51+
--! @return text Encrypted value at selector, implicitly cast from eql_v2_encrypted
5152
--! @see eql_v2."->>"(eql_v2_encrypted, text)
5253
CREATE FUNCTION eql_v2."->>"(e eql_v2_encrypted, selector eql_v2_encrypted)
5354
RETURNS text
@@ -63,4 +64,4 @@ CREATE OPERATOR ->> (
6364
FUNCTION=eql_v2."->>",
6465
LEFTARG=eql_v2_encrypted,
6566
RIGHTARG=eql_v2_encrypted
66-
);
67+
);

0 commit comments

Comments
 (0)