Sha256: 3791adec3ac55403d2343ee65c421b66c604a860b4ef625981cfe58cf2e1ac22

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

PostgreSQL Tips
===============


* Quicky connect to a database 'foo' using
  the interactive shell:

  [elathan@velka elathan]$ psql foo -U postgres

  Use '\d' to show the tables after the connection.

  
* Execute an SQL command via psql:

  joy=# SELECT * FROM r_forum;

  Keep in mind that you have to use uppercase for SQL commands
  and don't forget the trailing ';'.


* Create a new database called 'foo':

  [elathan@velka elathan]$ createdb foo -U postgres
  CREATE DATABASE


* Dump 'foo' database to 'dump.out':

  [elathan@velka elathan]$ pg_dump -U postgres -db foo -Fc > dump.out

  '-Fc' is the output format. From the docs:
  
  'The most flexible output file format is the "custom" format (-Fc). 
  It allows for selection and reordering of all archived items, and is 
  compressed by default.'

* Drop database called foo:

  [elathan@velka elathan]$ dropdb joy -U postgres


* Restore foo using dump.out
 
  [elathan@velka elathan]$ pg_restore foo.out -d joy -U postgres


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.1.2 doc/pg.txt