Difference between revisions of "Working with PostgreSQL"

From edegan.com
Jump to navigation Jump to search
imported>Ed
(New page: Add PostgreSQL to the path if it isn't already: Control Panel->System->Advanced->Environmental Variables Add: C:\Program Files\PostgreSQL\9.0\bin)
 
imported>Ed
Line 1: Line 1:
 +
==Basic Configuration==
  
 
Add PostgreSQL to the path if it isn't already:
 
Add PostgreSQL to the path if it isn't already:
 
  Control Panel->System->Advanced->Environmental Variables
 
  Control Panel->System->Advanced->Environmental Variables
 
  Add: C:\Program Files\PostgreSQL\9.0\bin
 
  Add: C:\Program Files\PostgreSQL\9.0\bin
 +
 +
To use PLPerl on windows, you will need to be careful to mix and match the right versions of PostgreSQL and Perl.
 +
 +
Perl version 5.10.1 (a 64bit build is available from [http://www.activestate.com/activeperl/downloads ActiveState]) works with PostgreSQL 9.0.1 (64bit build 1500). To see your PostgreSQL version type:
 +
 +
psql -c "select version();" template1
 +
 +
To see your perl version type:
 +
 +
perl -v
 +
 +
With these two versions together you should be able to add plperl to template1 (which all new dbs will inherit) with the command:
 +
 +
createlang plperl template1
 +
 +
There is a [http://www.postgresql.org/docs/7.3/static/reference-client.html list of commands/client applications], with links to documentation, which is useful.
 +
 +
Create a user using pgAdmin or the createuser command:
 +
 +
createuser ed_egan
 +
 +
And then create a database again using pgAdmin or the createdb command:
 +
 +
createdb -O ed_egan DBName
 +
 +
 +
 +
==SQL Commands==
 +
 +
There is a list of [http://www.postgresql.org/docs/7.3/static/sql-commands.html SQL commands] that may help.

Revision as of 18:33, 15 February 2011

Basic Configuration

Add PostgreSQL to the path if it isn't already:

Control Panel->System->Advanced->Environmental Variables
Add: C:\Program Files\PostgreSQL\9.0\bin

To use PLPerl on windows, you will need to be careful to mix and match the right versions of PostgreSQL and Perl.

Perl version 5.10.1 (a 64bit build is available from ActiveState) works with PostgreSQL 9.0.1 (64bit build 1500). To see your PostgreSQL version type:

psql -c "select version();" template1

To see your perl version type:

perl -v

With these two versions together you should be able to add plperl to template1 (which all new dbs will inherit) with the command:

createlang plperl template1

There is a list of commands/client applications, with links to documentation, which is useful.

Create a user using pgAdmin or the createuser command:

createuser ed_egan

And then create a database again using pgAdmin or the createdb command:

createdb -O ed_egan DBName 


SQL Commands

There is a list of SQL commands that may help.