patternsqlModerate
disable warning from `drop table if exists`
Viewed 0 times
disabledropexistswarningfromtable
Problem
When I
Sometimes, I do expect that certain tables to not exist, and don't want to see many warnings like these in the output of a batch processing function/script.
Is there a way to disable this type of warning altogether?
DROP a table with the IF EXISTS clause (in PostgreSQL 11.x), it issues a warning as follows:=> DROP TABLE IF EXISTS tt;
NOTICE: table "tt" does not exist, skippingSometimes, I do expect that certain tables to not exist, and don't want to see many warnings like these in the output of a batch processing function/script.
Is there a way to disable this type of warning altogether?
Solution
The "warning" is in fact a "notice". You can disable the display of those notices trough the property
To only display warnings, but not notices use:
Note that this will disable all notices, including those sent through
client_min_messages which controls the minimum level of messages returned to the client. To only display warnings, but not notices use:
set client_min_messages = warning;Note that this will disable all notices, including those sent through
raise notice from e.g. a PL/pgSQL function.Code Snippets
set client_min_messages = warning;Context
StackExchange Database Administrators Q#228331, answer score: 15
Revisions (0)
No revisions yet.