Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tips:db:postgres [2018/05/03 14:54] – [pgmodeler] scipio | tips:db:postgres [2019/03/13 09:55] (current) – [Basic operations] scipio | ||
---|---|---|---|
Line 20: | Line 20: | ||
===== Basic operations ===== | ===== Basic operations ===== | ||
+ | |||
+ | < | ||
+ | # list databases | ||
+ | \l | ||
+ | |||
+ | # connect to database | ||
+ | \c giano | ||
+ | |||
+ | # list schema | ||
+ | \dn | ||
+ | |||
+ | # list tables in schema | ||
+ | \dt auth.* | ||
+ | |||
+ | # describe table | ||
+ | \d+ auth.users | ||
+ | |||
+ | # list of installed extensions | ||
+ | \dx | ||
+ | |||
+ | # enable expanded display | ||
+ | \x | ||
+ | </ | ||
+ | |||
+ | set search path for database | ||
+ | < | ||
+ | psql < | ||
+ | ALTER DATABASE database_name SET search_path TO schema_name, | ||
+ | </ | ||
+ | |||
drop role gianoauth | drop role gianoauth | ||
Line 53: | Line 83: | ||
ALTER USER gianoauth SET search_path TO auth; | ALTER USER gianoauth SET search_path TO auth; | ||
ALTER ROLE gianoauth IN DATABASE giano SET search_path TO auth; | ALTER ROLE gianoauth IN DATABASE giano SET search_path TO auth; | ||
+ | </ | ||
+ | |||
+ | create superuser < | ||
+ | < | ||
+ | createuser -P -s -e admin | ||
+ | </ | ||
+ | |||
+ | |||
+ | create user and database for sentry | ||
+ | < | ||
+ | CREATE ROLE sentry WITH PASSWORD ' | ||
+ | CREATE DATABASE sentry ENCODING ' | ||
</ | </ | ||
==== developer containers ===== | ==== developer containers ===== | ||
Line 82: | Line 124: | ||
apt install wget python3-pip | apt install wget python3-pip | ||
pip3 install -U pip | pip3 install -U pip | ||
- | cd /tmp | + | pip install |
- | wget https:// | + | |
- | pip install ./pgadmin4-2.0-py2.py3-none-any.whl | + | |
# define ip binding | # define ip binding |