--- a/postgres.rst Thu Dec 13 09:55:01 2018 +0200
+++ b/postgres.rst Thu Dec 13 10:29:15 2018 +0200
@@ -1,13 +1,13 @@
.. -*- coding: utf-8; -*-
==========
- Postgre.
+ Postgres
==========
.. contents::
:local:
-Installing on Debian.
-=====================
+Installing on Debian
+====================
Install and create new user and database::
@@ -35,8 +35,8 @@
https://wiki.debian.org/PostgreSql
Debian wiki instructions.
-List databases, schemas and tables.
-===================================
+List databases, schemas and tables
+==================================
Default database is ``postgres``.
@@ -64,14 +64,19 @@
=> SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;
=> \dt
+List users::
+
+ \du
+
Set default schema.
===================
::
set search_path to NAME;
+ set schema 'NAME';
-Database, table, index size.
-============================
+Database, table, index size
+===========================
Database size::
@@ -122,3 +127,8 @@
\o output_file
SELECT * FROM pg_class;
+Switch database::
+
+ \connect DBNAME
+ \c DBNAME
+