Skip to content

Commit 04fb904

Browse files
committed
docs(SDB): update
1 parent 4593502 commit 04fb904

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

serverless/sql-databases/how-to/use-row-level-security.mdx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,34 @@ This requires setting up different [IAM permissions sets](/identity-and-access-m
3232
psql "postgres://[user-or-application-id]:[api-secret-key]@[database-hostname]:5432/[database-name]?sslmode=require"
3333
```
3434

35-
2. Add sample data using the following command:
35+
2. Add sample data to the database using the following command:
3636
```sql
3737
CREATE TABLE pets (name varchar, keeper varchar, id int);
3838
INSERT INTO pets VALUES ('Stuart','role_admin',1),('Nemo','role_admin',2),('Alfie','role_readwrite',3),('Peanut','role_readwrite',4);
3939
```
4040

41-
3. Enable **Row Level Security**:
41+
3. Run the command below to enable **Row Level Security**:
4242
```sql
4343
ALTER TABLE pets ENABLE row level security;
4444
```
4545

46-
4. Create a PostgreSQL policy so that users or applications connecting with `role_readwrite` can access a `pet` row only if its `keeper` column value is `role_readwrite`:
46+
4. Run the command below to create a PostgreSQL policy so that users or applications connecting with `role_readwrite` can access a `pet` row only if its `keeper` column value is `role_readwrite`:
4747
```sql
4848
CREATE POLICY pets_keeper ON pets TO role_readwrite USING (keeper = current_user);
4949
```
5050

51-
5. (Optional) You can check that you can still see all data with your current connection:
51+
5. (Optional) Check that you can see all the data with your current connection:
5252
```sql
5353
SELECT * FROM pets;
5454
```
55-
This is expected as you are connected with `role_admin`. You can verify the current role your are connected with using the following command:
55+
All the data contained in the database displays, as you are connected with `role_admin`.
56+
57+
<Message type="tip">
58+
You can verify the current role your are connected with using the following command:
5659
```sql
5760
SELECT current_user;
5861
```
59-
62+
</Message>
6063

6164
## Create an IAM application with Row Level Security enabled
6265

0 commit comments

Comments
 (0)