skip to Main Content

Does, updating catalog table on postgres11 is good idea as it runs quicker? and I noticed this catelog update valid for future data only not existing ,is this true in all cases?

UPDATE pg_catalog.pg_attribute SET attnotnull = TRUE
WHERE attrelid = 'tttt2'::regclass 
AND attname = 'b';

2

Answers


  1. Chosen as BEST ANSWER

    Thanks for the responses:

    As I don't have dare to update catalog in prod without knowing the impact.

    I fallowed with not valid (Also suggested by @laurenz ). I will try to spend some time and share catalog impact, once I done some research.


  2. Modifying catalogs like that is a bad idea. It can lead to data corruption unless you know exactly what you are doing.

    In this special case, I recommend that you create a NOT VALID check constraint and use ALTER TABLE to validate it later. That avoids a long ACCESS EXCLUSIVE lock.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search