This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PostgreSQL 9.3.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit | |
| sudo su - postgres | |
| Run 'psql' to connect, or 'psql -E' to connect and show psql queries. | |
| Commands: | |
| \l | List databases | |
| \connect db_name | Use db_name database | |
| \dt | List tables | |
| \dv | List views |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- PostgreSQL 9.3.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit | |
| -- ============================================================================ | |
| -- Returns the comments for all columns in a table. | |
| -- | |
| -- Precondition: | |
| -- | |
| -- Assumes you are currently using a database. | |
| -- | |
| -- Usage: | |
| -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- PostgreSQL 9.3.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit | |
| -- ============================================================================ | |
| -- Create a view to easily read table comments. | |
| -- | |
| -- Returns: | |
| -- | |
| -- A list of table names and comments associated with them. | |
| -- | |
| -- Usage: | |
| -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- PostgreSQL 9.3.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit | |
| -- ============================================================================ | |
| -- Returns the comments for all functions we'll create. | |
| -- | |
| -- Precondition: | |
| -- | |
| -- Assumes you are currently using a database. | |
| -- | |
| -- Usage: | |
| -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- PostgreSQL 9.3.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit | |
| CREATE TABLE func_table ( | |
| id serial NOT NULL PRIMARY KEY, | |
| value integer NOT NULL | |
| ); | |
| -- | |
| -- Make column unique. | |
| -- | |
| ALTER TABLE func_table ADD CONSTRAINT unique_value UNIQUE (value); |
NewerOlder