Copy tables to an _old as backup 1CREATE TABLE new_table AS 2TABLE existing_table; See details in https://www.postgresqltutorial.com/postgresql-copy-table/
Read MoreRename an Index 1ALTER INDEX the_oldtablename_idx01 RENAME TO thenewtablename_idx01 NOTE: This has similar syntax for renaming primary key. The only difference noted is that for primary key, the suffix is always _pkey. In index, it's either idxNN or idexNN (where NN is a nunber, e.g. '01')
Read MoreUpdate comments on table columns 1COMMENT ON COLUMN <table_name>.<column_name> IS '<new_comment_here>'; See Stackoverflow reference and Postgres.org reference NOTE: Comment cannot be altered or dropped. To remove comment, set it to NULL as follows: 1COMMENT ON COLUMN …
Read More1psql -c "select table_name from INFORMATION_SCHEMA.views WHERE table_schema = ANY (current_schemas(false));" To filter, just use grep. See https://dba.stackexchange.com/questions/23836/how-to-list-all-views-in-sql-in-postgresql
Read More