1683
|
1 |
.. -*- coding: utf-8; -*-
|
|
2 |
.. include:: HEADER.rst
|
|
3 |
|
|
4 |
==========
|
|
5 |
Postgre.
|
|
6 |
==========
|
|
7 |
.. contents::
|
|
8 |
|
|
9 |
Installing on Debian.
|
|
10 |
=====================
|
|
11 |
|
|
12 |
Install and create new user and database::
|
|
13 |
|
|
14 |
$ sudo apt-get install postgresql postgresql-client
|
|
15 |
$ sudo su - postgres
|
|
16 |
postgres=# CREATE USER "mypguser" WITH PASSWORD 'mypguserpass';
|
|
17 |
postgres=# CREATE DATABASE "mypgdatabase" OWNER "mypguser";
|
|
18 |
postgres=# \q
|
|
19 |
|
|
20 |
Connect as user ``mypguser`` to new database::
|
|
21 |
|
|
22 |
$ su - mypguser
|
|
23 |
$ psql mypgdatabase
|
|
24 |
|
|
25 |
..
|
|
26 |
|
|
27 |
https://wiki.debian.org/PostgreSql
|
|
28 |
Debian wiki instructions.
|
|
29 |
|
1684
|
30 |
List all schemas and tables.
|
|
31 |
============================
|
|
32 |
|
|
33 |
Schemas::
|
|
34 |
|
|
35 |
=> select schema_name from information_schema.schemata;
|
|
36 |
=> select nspname from pg_catalog.pg_namespace;
|
|
37 |
=> \dn *
|
|
38 |
|