PostgreSQL (4)

Using Postgres inside docker container

These are my personal notes. Am running postgres docker image on a local linux box. If port 5432 is already in use, run this to see what process is using it: sudo ss -lptn ‘sport = :5432’ the above command will also display the pid using which you can kill the process. For example, if […]

Install psycopg2 on Ubuntu 18.04+

I was trying to install psycopg2 database adapter for PostgreSQL on Ubuntu 18.04. And was always getting an error when doing “pipenv install psycopg2”, complaining about “Python.h” missing. After much head-scratching, I found the issue. Multiple Python distributions confuse psycopg2 installation. Its like this. psycopg2 has two main dependencies libpq-dev python3-dev. On Ubuntu, you install […]

PostgreSQL Basics

Schema PostgreSQL Schema: Exactly like namespaces in SQL Server (dbo in SQL Server is equivalent to public in PostgreSQL. The default namespace.) Logical container of tables and other database objects You can have multiple schemas in a database Schemas (or namespaces) are useful in production environment in that we can assign users to them and […]

PostgreSQL installation and configuration on ubuntu 18.04

Installation: Bad way First install postgress from ubuntu repos (note: this will lag behind the latest version directly from postgreSQL official page but far easier to install and uninstall). sudo apt update sudo apt install postgresql postgresql-contrib Installation complete. contrib package contains additional postgres utilities. Installation: Latest Version : Right Way Create the file /etc/apt/sources.list.d/pgdg.list […]