Rename 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 MoreIf you see garbage characters instead of the expected non-English language, fix is easy. Install corresponding language pack (Japanese in this case) https://support.microsoft.com/en-us/windows/language-packs-for-windows-a5094319-a92d-18de-5b53-1cfc697cfca8 Set the locale for non-unicode programs. See …
Read Morehttps://unix.stackexchange.com/questions/44040/a-standard-tool-to-convert-a-byte-count-into-human-kib-mib-etc-like-du-ls1
Read MoreIn some cases, you may need to import the existing environments in bash. Use the following at the top of your script. 1if [ "${BASH_SOURCE[0]}" -ef "$0" ] 2then 3echo "Hey, you should source this script, not execute it!" 4exit 1 5fi See details in …
Read More