tips:db:postgres

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tips:db:postgres [2018/05/03 15:07] – [Basic operations] scipiotips:db:postgres [2019/03/13 09:55] (current) – [Basic operations] scipio
Line 20: Line 20:
  
 ===== Basic operations ===== ===== Basic operations =====
 +
 +<code>
 +# 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
 +</code>
 +
 +set search path for database
 +<code>
 +psql <database>
 +ALTER DATABASE database_name SET search_path TO schema_name,public;
 +</code>
 +
  
 drop role gianoauth drop role gianoauth
Line 58: Line 88:
 <code> <code>
 createuser -P -s -e admin createuser -P -s -e admin
 +</code>
 +
 +
 +create user and database for sentry
 +<code>
 +CREATE ROLE sentry WITH PASSWORD 'blabla' LOGIN;
 +CREATE DATABASE sentry ENCODING 'UTF8' OWNER sentry;
 </code> </code>
 ==== developer containers ===== ==== developer containers =====
Line 87: Line 124:
 apt install wget python3-pip apt install wget python3-pip
 pip3 install -U pip pip3 install -U pip
-cd /tmp +pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.2/pip/pgadmin4-4.2-py2.py3-none-any.whl
-wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl +
-pip install ./pgadmin4-2.0-py2.py3-none-any.whl+
  
 # define ip binding # define ip binding
  • tips/db/postgres.1525352848.txt.gz
  • Last modified: 2018/05/03 15:07
  • by scipio