Skip to content

Commit abd8418

Browse files
committed
fix(docs): replace ambiguous search_value with $1 parameter
SQL examples using undefined 'search_value' variable would cause "column does not exist" errors if copied verbatim. Changed to $1 placeholder to indicate query parameter usage. Fixes common issue identified by dual-verification review.
1 parent 1cb7c18 commit abd8418

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/reference/database-indexes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ Convert both sides to `jsonb[]` and use the native containment operator:
362362
```sql
363363
SELECT * FROM table_name
364364
WHERE eql_v2.jsonb_array(encrypted_column) @>
365-
eql_v2.jsonb_array(search_value::eql_v2_encrypted);
365+
eql_v2.jsonb_array($1::eql_v2_encrypted);
366366
```
367367

368368
#### Approach 2: Using Helper Function
@@ -371,7 +371,7 @@ Use the convenience function which handles the conversion internally:
371371

372372
```sql
373373
SELECT * FROM table_name
374-
WHERE eql_v2.jsonb_contains(encrypted_column, search_value::eql_v2_encrypted);
374+
WHERE eql_v2.jsonb_contains(encrypted_column, $1::eql_v2_encrypted);
375375
```
376376

377377
Both approaches produce the same result and use the GIN index.
@@ -383,7 +383,7 @@ Use `EXPLAIN` to verify the GIN index is being used:
383383
```sql
384384
EXPLAIN SELECT * FROM table_name
385385
WHERE eql_v2.jsonb_array(encrypted_column) @>
386-
eql_v2.jsonb_array(search_value::eql_v2_encrypted);
386+
eql_v2.jsonb_array($1::eql_v2_encrypted);
387387
```
388388

389389
**Expected output:**

docs/reference/index-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ For efficient containment queries on large tables, you can create a GIN index us
236236
CREATE INDEX idx_encrypted_jsonb ON mytable USING GIN (eql_v2.jsonb_array(encrypted_col));
237237

238238
-- Query using containment (will use the GIN index)
239-
SELECT * FROM mytable WHERE encrypted_col @> search_value;
239+
SELECT * FROM mytable WHERE encrypted_col @> $1::eql_v2_encrypted;
240240
```
241241

242242
The following helper functions are available for GIN-indexed containment queries:

docs/reference/json-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ ANALYZE examples;
115115
-- Query using the GIN index
116116
SELECT * FROM examples
117117
WHERE eql_v2.jsonb_array(encrypted_json) @>
118-
eql_v2.jsonb_array(search_value::eql_v2_encrypted);
118+
eql_v2.jsonb_array($1::eql_v2_encrypted);
119119
```
120120

121121
See [GIN Indexes for JSONB Containment](./database-indexes.md#gin-indexes-for-jsonb-containment) for complete setup instructions.

0 commit comments

Comments
 (0)