'Postgres' Category

  • Install a new version of PostgreSQL server

    January 5, 2018
    Install a new version of PostgreSQL server. dpkg-query -l postgresql* Looks like the Debian upgrade included PostgreSQL 9.6, but I still need to upgrade from 9.1 to 9.6. Run `pg_lsclusters`, your 9.1 and 9.6 main clusters should be “online”. pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 9.1 main 5432 online postgres /var/lib/postgresql/9.1/main […]
  • Postgres equivalent show create table

    February 27, 2016
    Problem solved ! Here is a pure sql solution, how to get all sql from all tables in Postgres: — — — NB 27.02.16 — List sql tables — show_create_table() — — SELECT ‘CREATE TABLE ‘||sql.table||'(‘ ||array_to_string(array_agg(sql),’, ‘) ||’)’ as sql FROM ( ( SELECT — FIELDS c.oid AS id ,c.relname as table ,9 as […]