postgres: https://github.com/porsager/postgres Czytaj dalej Pakiet npm – postgres
Kategoria: PostgreSQL
Postgres – tabele
Tworzenie tabeli
CREATE TABLE users ( id serial primary key, name varchar(80), age int, -- how many years temp_hi int, -- high temperature prcp real, -- precipitation date date );
-- <komentarz>
DESC users – struktura tabeli users
\d+ users
Typy
int, smallint, real, double precision, char(N), varchar(N), date, time, timestamp, interval
Wstawianie danych – kopiowanie z pliku do tabeli
COPY users FROM '/home/joe/users.txt';
Postgres – komendy
Poziom klienta – terminala psql
\l[+] - lista baz danych \dt[+] - lista tabel \dp - tabele, widoki, uprawnienia \du - użytkownicy / role
DESC users – struktura tabeli users
\d+ users
\dT[+] - schema \dO[+] - collations
help \?
\q - WYJŚCIE exit
select version(); PostgreSQL 13.20 (Debian 13.20-0+deb11u1) on x86_64-pc-linux-gnu, compiled by gcc
Postgresql – databases
Postgresql – users
Jako użytkownik postgres (su – postgres)
# shell createuser --pwprompt username # pyta o hasło
Postgresql – konfiguracja
Pliki konfiguracyjne
# ls /etc/postgresql/13/main/ conf.d environment pg_ctl.conf pg_hba.conf pg_ident.conf postgresql.conf start.conf
Restart serwera Postgresql
systemctl restart postgresql
Postgresql instalacja
apt install postgresql