Within the Advanced tab of a Resource Query, add the ability to SET sql variables before a sql command is executed. For example:
SET my.user.activeUserId = {{localStorage.values.activeUserId}};
For example: This can be very useful for things like row security policies where we can use a session variable to only show rows that belong to the active user.
Row Security Policies are a great feature of PostgreSQL and it would be great if we could leverage them in Retool.
I'd defer to the Postgres docs since it doesn't look like we have any Retool specific docs on this. The feature isn't listed in the advanced tab. Rather, you'd use the Postgres integration & write your queries in 'SQL mode,' where you can write multiple Postgres queries