

Then a name migration could work like this:

I was hoping there was some way to "add a name" to a table or column, so that old_name and new_name will both work, and then at a later time remove the old name. If existing clients are using the old name, you can't just yank it out from under them. PostgreSQL lets you rename tables and columns via alter table, but often this isn't feasible in a production without significant downtime. Sometimes one name is used in developing a feature, but testing with real users reveals that a better name is needed, and it'd be nice to have the names for things in the DB match the names used in the UI. Maybe requirements shifted slightly, or maybe as time went on, a better understanding of the concept being represented developed.
name : Create tbl2 in the acme database with the DDL like tbl1 with testuser as an owner postgresql_table : db : acme name : tbl2 like : tbl1 owner : testuser - name : Create tbl2 in the acme database and tablespace ssd with the DDL like tbl1 including comments and indexes postgresql_table : db : acme table : tbl2 like : tbl1 including : comments, indexes tablespace : ssd - name : Create test_table with several columns in ssd tablespace with fillfactor=10 and autovacuum_analyze_threshold=1 postgresql_table : name : test_table columns : - id bigserial primary key - num bigint - stories text tablespace : ssd storage_params : - fillfactor=10 - autovacuum_analyze_threshold=1 - name : Create an unlogged table in schema acme postgresql_table : name : eless_data columns : waste_id int unlogged : true - name : Rename table foo to bar postgresql_table : table : foo rename : bar - name : Rename table foo from schema acme to bar postgresql_table : name : acme.foo rename : bar - name : Set owner to someuser postgresql_table : name : foo owner : someuser - name : Change tablespace of foo table to new_tablespace and set owner to new_user postgresql_table : name : foo tablespace : new_tablespace owner : new_user - name : Truncate table foo postgresql_table : name : foo truncate : yes - name : Drop table foo from schema acme postgresql_table : name : acme.It often happens that the original name something is given is not the best name.

PostgreSQL data typesĬomplete reference of the PostgreSQL data types documentation. DROP TABLE referenceĬomplete reference of the DROP TABLE command documentation. ALTER TABLE referenceĬomplete reference of the ALTER TABLE command documentation. CREATE TABLE referenceĬomplete reference of the CREATE TABLE command documentation. The official documentation on the postgresql_copy module. postgresql_copy – Copy data between a file/program and a PostgreSQL table The official documentation on the postgresql_privs module. postgresql_privs – Grant or revoke privileges on PostgreSQL database objects The official documentation on the postgresql_owner module. postgresql_owner – Change an owner of PostgreSQL database object The official documentation on the postgresql_tablespace module. postgresql_tablespace – Add or remove PostgreSQL tablespaces from remote hosts The official documentation on the postgresql_info module. postgresql_info – Gather information about PostgreSQL servers The official documentation on the postgresql_sequence module. See also postgresql_sequence – Create, drop, or alter a PostgreSQL sequence
