Open steve-chavez opened 5 months ago
create function raise_blah() returns void language plpgsql as $$ begin raise INFO 'Blah-1'; raise 'Blah-2'; raise DEBUG 'Blah-3'; raise LOG 'Blah-4'; raise NOTICE 'Blah-5'; raise WARNING 'Blah-6'; end $$;
This is kind of an odd test-case, I think. The second raise
will throw an error, so stop execution of that block - so none of the others will be executed. Wouldn't it be better if that breaking raise came last? Would any of the others result in log output, too?
Right, my mistake. Using:
create function raise_blah() returns void
language plpgsql
as $$
begin
raise INFO 'Blah-1';
raise DEBUG 'Blah-3';
raise LOG 'Blah-4';
raise NOTICE 'Blah-5';
raise WARNING 'Blah-6';
raise 'Blah-2';
end
$$;
alter role postgrest_test_authenticator set client_min_messages to DEBUG5;
$ curl localhost:3000/rpc/raise_blah
{"code":"P0001","details":null,"hint":null,"message":"Blah-2"}
I get:
LOG: statement: SET client_encoding = 'UTF8';SET client_min_messages TO WARNING;
25/Jun/2024:18:16:46 -0500: Listening for notifications on the "pgrst" channel
25/Jun/2024:18:16:46 -0500: Config reloaded
25/Jun/2024:18:16:46 -0500: Schema cache queried in 14.4 milliseconds
25/Jun/2024:18:16:46 -0500: Schema cache loaded 266 Relations, 221 Relationships, 144 Functions, 15 Domain Representations, 45 Media Type Handlers
INFO: Blah-1
WARNING: Blah-6
Something is always setting SET client_min_messages TO WARNING;
, that's why the other RAISEs don't show. Maybe it's the connection pool.
Something is always setting
SET client_min_messages TO WARNING;
, that's why the other RAISEs don't show. Maybe it's the connection pool.
Seems to happen here:
Problem
Doing:
Results in this:
It doesn't matter if
client_min_messages
is set:Because:
All of this PostgREST behavior is undocumented.
Solution
Document it.
Notes