6

When I 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, skipping

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?

1 Answer 1

15

The "warning" is in fact a "notice". You can disable the display of those notices trough the property 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.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.