title: Temporarily deactivate constraints for updating datatype of PKs and FKs
body: <p>I have to update all columns of type "uuid" to "varchar(38)". I created all the necessary queries with:  </p>
  
  <pre><code>SELECT format(
    'ALTER TABLE %I.%I.%I ALTER COLUMN %I SET DATA TYPE varchar(38);',
    table_catalog,
    table_schema,
    table_name,
    column_name
  )
  FROM information_schema.columns
  WHERE data_type = 'uuid'
    AND table_schema NOT LIKE 'pg_%'
    AND lower(table_schema) &lt;&gt; 'information_schema'
    AND is_updatable = 'YES';
  </code></pre>
  
  <p>Obviously, I can't execute the resulting queries because of all the existing PK and FK constraints involving the uuid columns.<br>
  Is there a way to temporarily disable the constraints, then executing all the queries and reactivating the constraints afterwards without dropping the constraints?<br>
  Or if I have to drop all the constraints first, is there a way to set them all up again after the updates? I am not the creator of the database so I don't have all necessary queries to create the constraints again.</p>