PostgreSQL

This is the open source database server for all the GNUmed project. If you are new to Postgres, its project home is here

Basics

Things you may already know, or may need to know:
  • the postgres file locations and even the tools can vary between debian and other systems
  • in debian, the package name is postgresql and its pg_hba.conf and related files are located in /etc/postgresql/8.x/main
  • for Mac OS, see wiki page PostgresOnMac
  • you need to become the operating system user under which Postgres was installed (usually postgres, therefore su postgres) in order to create any other Postgres user account, including the gm-dbo account created for GNUmed
    • distinctions between the postgres system account and the postgres and gm-dbo database accounts are on the devel archive here
    • during bootstrapping, the precaution is taken to save, into the database defaults, settings that include transactions as read-only:
      curs.execute("alter database %s set default_transaction_read_only to on" % self.name)
      and it is sanity checked during client startup:
      u'default_transaction_read_only': [u'on', u'accidental database writes', False],
    • accordingly, when trying to run a write operation, one must run set transaction_read_only to off; within the same transaction in which one is trying to run a write operation (such as deleting a person)

Performance design here.

Troubleshooting postgres for GNUmed

See the wiki page dedicated to troubleshooting.

Miscellaneous

Postgres server related commands (as root, on debian)

psql bits & pieces (run as user postgres)
  • can you access psql? try
    psql template1 or (after reconfiguration) psql template1 -U postgres
  • if you get "command not found"
  • \h for help with SQL commands
  • \? for help with psql commands
  • \q to exit

pgAdmin III bits & pieces

Potentially useful but at risk of getting outdated as new Postgres versions are released:
Topic revision: 02 Aug 2011, JamesBusser
 
Download.png
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
Powered by Olark