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
The column **must** be of type `eql_v2_encrypted`.
14
+
If you try to configure a column that doesn't exist in the database, you'll get the error:
15
+
16
+
```
17
+
ERROR: Some pending columns do not have an encrypted target
18
+
```
19
+
20
+
## Initializing column configuration
21
+
22
+
After creating the encrypted column, initialize it for use with CipherStash Proxy using the `eql_v2.add_column` function:
4
23
5
24
```sql
6
-
SELECTeql_v2.add_column('users', 'encrypted_email', 'text'); --where users is the table name and encrypted_email is the column name of type eql_v2_encrypted
25
+
SELECTeql_v2.add_column('users', 'encrypted_email', 'text'); --Configure the existing encrypted column
7
26
```
8
27
9
28
**Full signature:**
10
29
```sql
11
30
SELECTeql_v2.add_column(
12
31
'table_name', -- Name of the table
13
-
'column_name', -- Name of the column (must be of type eql_v2_encrypted)
32
+
'column_name', -- Name of the encrypted column (must already exist as type eql_v2_encrypted)
14
33
'cast_as', -- PostgreSQL type to cast decrypted data [optional, defaults to 'text']
15
34
migrating -- If true, stages changes without immediate activation [optional, defaults to false]
16
35
);
17
36
```
18
37
19
38
**Note:** This function allows you to encrypt and decrypt data but does not enable searchable encryption. See [Searching data with EQL](#searching-data-with-eql) for enabling searchable encryption.
20
39
21
-
## Refreshing CipherStash Proxy Configuration
40
+
## Complete setup workflow
41
+
42
+
Here's the complete workflow to set up an encrypted column with search capabilities:
43
+
44
+
```sql
45
+
-- Step 1: Create the encrypted column in your table
CipherStash Proxy refreshes the configuration every 60 seconds. To force an immediate refresh, run:
24
62
@@ -35,7 +73,7 @@ Encrypted data is stored as `jsonb` values in the PostgreSQL database, regardles
35
73
36
74
You can read more about the data format [here](docs/reference/payload.md).
37
75
38
-
### Inserting Data
76
+
### Inserting data
39
77
40
78
When inserting data into the encrypted column, wrap the plaintext in the appropriate EQL payload. These statements must be run through the CipherStash Proxy to **encrypt** the data.
41
79
@@ -64,7 +102,7 @@ Data is stored in the PostgreSQL database as:
64
102
}
65
103
```
66
104
67
-
### Reading Data
105
+
### Reading data
68
106
69
107
When querying data, select the encrypted column. CipherStash Proxy will **decrypt** the data automatically.
70
108
@@ -100,6 +138,8 @@ In order to perform searchable operations on encrypted data, you must configure
100
138
101
139
### Adding an index
102
140
141
+
**Prerequisites:** The encrypted column must already exist in the database (see [Prerequisites](#prerequisites)) and be configured with `eql_v2.add_column`.
142
+
103
143
Add an index to an encrypted column using the `eql_v2.add_search_config` function:
104
144
105
145
```sql
@@ -366,4 +406,20 @@ Use these functions to manage your EQL configurations:
366
406
**Important Behavior Differences:**
367
407
-`remove_search_config()` removes only the specified index but preserves the column configuration (including `cast_as` setting)
368
408
-`remove_column()` removes the entire column configuration including all its indexes
369
-
- Empty configurations (no tables/columns) are automatically maintained as active to reflect the current state
409
+
- Empty configurations (no tables/columns) are automatically maintained as active to reflect the current state
410
+
411
+
## Troubleshooting
412
+
413
+
### Common errors
414
+
415
+
**Error: "Some pending columns do not have an encrypted target"**
416
+
-**Cause**: You're trying to configure a column that doesn't exist as `eql_v2_encrypted` type in the database
417
+
-**Solution**: First create the encrypted column with `ALTER TABLE table_name ADD COLUMN column_name eql_v2_encrypted;`
418
+
419
+
**Error: "Config exists for column: table_name column_name"**
420
+
-**Cause**: You're trying to add a column that's already configured
421
+
-**Solution**: Use `eql_v2.add_search_config()` to add indexes to existing columns, or `eql_v2.remove_column()` first if you want to reconfigure
422
+
423
+
**Error: "No configuration exists for column: table_name column_name"**
424
+
-**Cause**: You're trying to add search config to a column that hasn't been configured with `add_column` yet
425
+
-**Solution**: First run `eql_v2.add_column()` to configure the column, then add search indexes
0 commit comments