Fix GUC names using the old syntax

This commit is contained in:
Laurence Isla
2021-11-30 18:17:40 -05:00
committed by Steve Chavez
parent c46c3b7a86
commit d5fb73bf9b
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -2523,7 +2523,7 @@ As an example, let's add some cache headers for all requests that come from an I
create or replace function custom_headers() returns void as $$ create or replace function custom_headers() returns void as $$
declare declare
user_agent text := current_setting('request.header.user-agent', true); user_agent text := current_setting('request.headers', true)::json->>'user-agent';
begin begin
if user_agent similar to '%MSIE (6.0|7.0)%' then if user_agent similar to '%MSIE (6.0|7.0)%' then
perform set_config('response.headers', perform set_config('response.headers',
+1 -1
View File
@@ -95,7 +95,7 @@ SQL code can access claims through GUC variables set by PostgREST per request. F
.. code:: sql .. code:: sql
current_setting('request.jwt.claim.email', true) current_setting('request.jwt.claims', true)::json->>'email';
This allows JWT generation services to include extra information and your database code to react to it. For instance the RLS example could be modified to use this current_setting rather than current_user. The second 'true' argument tells current_setting to return NULL if the setting is missing from the current configuration. This allows JWT generation services to include extra information and your database code to react to it. For instance the RLS example could be modified to use this current_setting rather than current_user. The second 'true' argument tells current_setting to return NULL if the setting is missing from the current configuration.
+1 -1
View File
@@ -212,7 +212,7 @@ First make a new schema and add the function:
language plpgsql language plpgsql
as $$ as $$
begin begin
if current_setting('request.jwt.claim.email', true) = if current_setting('request.jwt.claims', true)::json->>'email' =
'disgruntled@mycompany.com' then 'disgruntled@mycompany.com' then
raise insufficient_privilege raise insufficient_privilege
using hint = 'Nope, we are on to you'; using hint = 'Nope, we are on to you';