Child pages
  • PostgreSQL Primer

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For production purposes, it's advised to use the EnterpriseDb Standard Server installer. For development and test purposes, both the embedded PostgreSQL database  engine and the EnterpriseDB option would be sufficient.

Upgrading PostgreSQL

Embedded PostgreSQL database engine

TODO

EnterpriseDB installation

Upgrading an EnterpriseDB Standard Server installation to the next maintenance release, lets say 9.0.1 to 9.0.2, can be done by running the 9.0.2 installer. It will automatically find the 9.0.1 installation and update it. Make sure to stop Servoy (and any other client connecting to PostgreSQL) performing the upgrade.

...

Running PostgreSQL as a Service

Windows

The pg_ctl utility that comes with PostgreSQL has a built-in command to register the PostgreSQL database as a Windows Service

...

When also running the Servoy Application Server using the Service Component, a dependency can be setup between the Windows Service for the database and the Application Server. See Running the server as a service for more information.

OSX

TODO, for now see http://www.postgresql.org/docs/9.0/interactive/server-start.html

*nix

TODO, for now see http://www.postgresql.org/docs/9.0/interactive/server-start.html

...

PostgreSQL stores it's data in a 'database cluster' which is a collection of files and directories that together make up the entire database. It's not recommended to backup these files, but instead use the backup utilities that come with PostgreSQL.

Manual backups

PostgreSQL provides a pg_dump and a pg_dumpall utility to make a backup file of a running database. In a default installation of Servoy, the utilities are located in ../application_server/postgres_db/bin/. These utilities can be used command-line, but also through the PgAdmin utility.

...

The samples above assume execution from the ../application_server/ directory.

...

Scheduled backups

...

TODO: see http://www.servoy.com/forum/viewtopic.php?f=4&t=15208#p81450 for input

PostgreSQL Database Admin tool

...

PostgreSQL SQL Tips 'n' Tricks

No automatic type casting

PostgreSQL doesn't do automatic casting of types. This means that when sending in parameters into a prepared statement, it is up to the developer to make sure to send in the right type.

...

Code Block
var value = 1;
var query = 'SELECT * FROM table WHERE textcolumn = ?'
var args = new Array();
args[0] = value + ""; //forcing the integer value to become a string
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, args, maxReturnedRows);

Quoting strings and aliases 

In PostgreSQL, the use of quotes and double quotes is more strict than in some other databases.

...