![]() ![]() ![]() 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. When you rename a table, postgresql will automatically update its dependent objects like indexes, constraints and views. ![]() ![]() 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 Overview of PostgreSQL rename table statement. The official documentation on the postgresql_privs module. Summary: this tutorial shows you how to rename a table by using the PostgreSQL RENAME table clause of the ALTER TABLE statement. 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. Connect to some other database other than the one you are trying to rename such as say the postgres db.See also postgresql_sequence – Create, drop, or alter a PostgreSQL sequence.In order to do it, you need to first make sure everyone is out of the database (including yourself) otherwise you'll get an annoying database is being accessed by other users or current database may not be renamed error. However there is a simple way of doing it with a PostgreSQL command which has been in existence even in the 7.4 days of PostgreSQL which is documented in PostgreSQL official docs on ALTER DATABASE. Just one of the ways PgAdmin III lets us down. If you are using PgAdmin III, you will not see this option. How do you rename this database? Solution: You've created a database but made an embarrassing typo in the name or for whatever reason you don't like it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |