PostgreSQL - Offirmo-team/wiki GitHub Wiki

Voir aussi base de données, SQL

Introduction

https://www.postgresql.org/

Une base de données "couteau suisse". Fonctionalités:

Récent:

Sécurité

http://www.ibm.com/developerworks/library/os-postgresecurity/

Installation

Local

sudo apt-get install postgresql
sudo apt-get install libpq-dev

cloud

heroku addons:add heroku-postgresql:dev
heroku pg:promote HEROKU_POSTGRESQL_CHARCOAL_URL

config

sudo -u postgres psql
SHOW config_file;
-> /etc/postgresql/9.3/main/postgresql.conf
-> /etc/postgresql/9.3/main/pg_hba.conf

Utilisation

nommage

Commandes

relancer

sudo /etc/init.d/postgresql restart

requêtage

Voir SQL

Schéma

types de donnée

Clients

Commun

"Connection string" postgres://someuser:somepassword@somehost:381/somedatabase

Clients graphiques

connecteurs

node.js

https://medium.com/dailyjs/postgresql-with-nodejs-d0dcedba5884

Avancé

NoSQL

SELECT
  articles.metadata->'foo'->'date' AS date
WHERE
  articles.metadata #>> '{foo,date}' = '2015-01-28'

full text search

http://blog.lostpropertyhq.com/postgres-full-text-search-is-good-enough/

Problèmes rencontrés

KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

Combo of version problem node + pg. For now, use a clean node 12: nvm use