473,545 Members | 529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run 2 versions of Postgresql on one machine?

hi,

I just took over a project done by somebody else of some C extension of
Postgresql 7.1.3. And now I have to port it to pl/pgsql. The guy who
developed it said he didn't get it running under 7.2 for some reason. And I
suspect it might not run properly under 7.4.1. Since I only have one machine
so I really hope that I could run 7.1.3 and 7.4.1 on the same machine and
run his code on 7.1.3 while developing pl/pgsql on 7.4.1. Now can anyone
give a hand on whether this can be done, and if so, can you give me a little
direction on how to do this?
Many thanks,

Wei
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 22 '05 #1
9 4837
Hi wei,

it is quite easy to have two different version of postgres running on
one machine. You need 2 different directories for the data files and 2
different ports for the 2 postmasters to listen.

-first you prepare the data directories with initdb, you can use the -D
parameter to give the location of the files.
-then start the database (postmaster) with parameter -p PORTNUMBER.
Default port is 5432 so your existing postmaster process will probably
listen there. The new version should listen on another port. All of the
other Postgres utilities (pgsql, createdb, ...) also need the -p
PORTNUMBER info as well, so they can connect to the right postmaster
process.

Hope that helps,

peter

ps: if you install from the Postgres source, you can specify a new
default port number for your installation via a ./configure switch.
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #2
On Friday 06 February 2004 15:01, Wei Wang wrote:
hi,

I just took over a project done by somebody else of some C extension of
Postgresql 7.1.3. And now I have to port it to pl/pgsql. The guy who
developed it said he didn't get it running under 7.2 for some reason. And I
suspect it might not run properly under 7.4.1. Since I only have one
machine so I really hope that I could run 7.1.3 and 7.4.1 on the same
machine and run his code on 7.1.3 while developing pl/pgsql on 7.4.1. Now
can anyone give a hand on whether this can be done, and if so, can you give
me a little direction on how to do this?


Build both from source.
Set the install directories for each differently (/usr/local/pg713/ or
something)
Set the ports for both differently (can't both use 5432 at the same time)
Initialise both to use different PGDATA directories
Alter startup scripts to start both separately, or start them manually.

That should do it - worth checking the archives since other people have done
this.
Hmm - do a search for Debian on the list archives (-hackers list IIRC) too. I
think the new packaging scheme there does the above out of the box - you
could just copy what it does.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #3
"Peter Alberer" <h9******@obeli x.wu-wien.ac.at> writes:
it is quite easy to have two different version of postgres running on
one machine. You need 2 different directories for the data files and 2
different ports for the 2 postmasters to listen. -first you prepare the data directories with initdb, you can use the -D
parameter to give the location of the files.
-then start the database (postmaster) with parameter -p PORTNUMBER.
Default port is 5432 so your existing postmaster process will probably
listen there. The new version should listen on another port. All of the
other Postgres utilities (pgsql, createdb, ...) also need the -p
PORTNUMBER info as well, so they can connect to the right postmaster
process.


You will also need to make sure that the executables and library files
get installed into different places, else one version will overwrite the
other at install time. I am not sure how to do that with an RPM-based
installation, but it is quite easy if you are building from source:
just supply a --prefix option to "configure" . Perhaps

./configure --prefix=/usr/local/pgsql735

to install everything under /usr/local/pgsql735 (executables in
/usr/local/pgsql735/bin, etc).

Another thing you can do when building from source is to give each
version a different default port number:

./configure --prefix=/usr/local/pgsql735 --with-pgport=5735

This is pretty handy because the created postmaster, psql, and other
utilities will automatically use the right port number for their
version, and you don't have to fool around with setting it as Peter
mentions above. All that you have to do is adjust your PATH to find
the psql you want to use at the moment.

BTW, there is nothing that says you need to install under /usr. If you
are just testing, it is perfectly possible to build, install, and create
the data directory in directories under your own home directory, and
then manually start the postmaster running as yourself. This wouldn't
be good when you want the postmaster auto-started at system boot, but
for a temporary testing setup it's cool --- you do not need root
privileges at all when doing it this way.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 22 '05 #4
Thank you all for your kind help. I have set up 7.4.1 and it's up and
running perfectly.
One small question that might not belong in this mailing list:
Since all the binary commands share the same name, e.g. initdb, createdb,
psql, etc, and the
default path is already the 7.1.3 version. How do I come up a way to access
binary commands of
both versions quickly without adding absolute path infront of those of
7.4.1?
Many thanks,

Wei

----- Original Message -----
From: "Tom Lane" <tg*@sss.pgh.pa .us>
To: "Peter Alberer" <h9******@obeli x.wu-wien.ac.at>
Cc: "'Wei Wang'" <ww***@cam.ac.u k>; <pg***********@ postgresql.org>
Sent: Friday, February 06, 2004 5:04 PM
Subject: Re: [GENERAL] Run 2 versions of Postgresql on one machine?

"Peter Alberer" <h9******@obeli x.wu-wien.ac.at> writes:
it is quite easy to have two different version of postgres running on
one machine. You need 2 different directories for the data files and 2
different ports for the 2 postmasters to listen.

-first you prepare the data directories with initdb, you can use the -D
parameter to give the location of the files.
-then start the database (postmaster) with parameter -p PORTNUMBER.
Default port is 5432 so your existing postmaster process will probably
listen there. The new version should listen on another port. All of the
other Postgres utilities (pgsql, createdb, ...) also need the -p
PORTNUMBER info as well, so they can connect to the right postmaster
process.


You will also need to make sure that the executables and library files
get installed into different places, else one version will overwrite the
other at install time. I am not sure how to do that with an RPM-based
installation, but it is quite easy if you are building from source:
just supply a --prefix option to "configure" . Perhaps

./configure --prefix=/usr/local/pgsql735

to install everything under /usr/local/pgsql735 (executables in
/usr/local/pgsql735/bin, etc).

Another thing you can do when building from source is to give each
version a different default port number:

./configure --prefix=/usr/local/pgsql735 --with-pgport=5735

This is pretty handy because the created postmaster, psql, and other
utilities will automatically use the right port number for their
version, and you don't have to fool around with setting it as Peter
mentions above. All that you have to do is adjust your PATH to find
the psql you want to use at the moment.

BTW, there is nothing that says you need to install under /usr. If you
are just testing, it is perfectly possible to build, install, and create
the data directory in directories under your own home directory, and
then manually start the postmaster running as yourself. This wouldn't
be good when you want the postmaster auto-started at system boot, but
for a temporary testing setup it's cool --- you do not need root
privileges at all when doing it this way.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #5
Wei Wang wrote:
Thank you all for your kind help. I have set up 7.4.1 and it's up and
running perfectly.
One small question that might not belong in this mailing list:
Since all the binary commands share the same name, e.g. initdb, createdb,
psql, etc, and the
default path is already the 7.1.3 version. How do I come up a way to access
binary commands of
both versions quickly without adding absolute path infront of those of
7.4.1?

Well if you are using 7.4.1 primarily you can just change the path order
so that the pgsql/bin for 7.4.1 comes
before the pgsql/bin for 7.1.3. If not, you could set up some aliases...
if you are using bash:

alias psql74 = '/usr/local/pgsql74/bin/psql'


Many thanks,

Wei

----- Original Message -----
From: "Tom Lane" <tg*@sss.pgh.pa .us>
To: "Peter Alberer" <h9******@obeli x.wu-wien.ac.at>
Cc: "'Wei Wang'" <ww***@cam.ac.u k>; <pg***********@ postgresql.org>
Sent: Friday, February 06, 2004 5:04 PM
Subject: Re: [GENERAL] Run 2 versions of Postgresql on one machine?
"Peter Alberer" <h9******@obeli x.wu-wien.ac.at> writes:
it is quite easy to have two different version of postgres running on
one machine. You need 2 different directories for the data files and 2
different ports for the 2 postmasters to listen.

-first you prepare the data directories with initdb, you can use the -D
parameter to give the location of the files.
-then start the database (postmaster) with parameter -p PORTNUMBER.
Default port is 5432 so your existing postmaster process will probably
listen there. The new version should listen on another port. All of the
other Postgres utilities (pgsql, createdb, ...) also need the -p
PORTNUMBER info as well, so they can connect to the right postmaster
process.


You will also need to make sure that the executables and library files
get installed into different places, else one version will overwrite the
other at install time. I am not sure how to do that with an RPM-based
installatio n, but it is quite easy if you are building from source:
just supply a --prefix option to "configure" . Perhaps

./configure --prefix=/usr/local/pgsql735

to install everything under /usr/local/pgsql735 (executables in
/usr/local/pgsql735/bin, etc).

Another thing you can do when building from source is to give each
version a different default port number:

./configure --prefix=/usr/local/pgsql735 --with-pgport=5735

This is pretty handy because the created postmaster, psql, and other
utilities will automatically use the right port number for their
version, and you don't have to fool around with setting it as Peter
mentions above. All that you have to do is adjust your PATH to find
the psql you want to use at the moment.

BTW, there is nothing that says you need to install under /usr. If you
are just testing, it is perfectly possible to build, install, and create
the data directory in directories under your own home directory, and
then manually start the postmaster running as yourself. This wouldn't
be good when you want the postmaster auto-started at system boot, but
for a temporary testing setup it's cool --- you do not need root
privileges at all when doing it this way.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandpromp t.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #6
On Friday 06 February 2004 18:21, Wei Wang wrote:
Thank you all for your kind help. I have set up 7.4.1 and it's up and
running perfectly.
One small question that might not belong in this mailing list:
Since all the binary commands share the same name, e.g. initdb, createdb,
psql, etc, and the
default path is already the 7.1.3 version. How do I come up a way to access
binary commands of
both versions quickly without adding absolute path infront of those of
7.4.1?


Make symlinks to the relevant version, so:

ln -s /usr/local/pg741/bin/psql psql741

Then you can call psql741 (although be careful with any environment
settings)..

If you don't like that, write a 2-line shell script to call the right one for
you.
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #7
Joshua D. Drake wrote:
Wei Wang wrote:

Thank you all for your kind help. I have set up 7.4.1 and it's up and
running perfectly.
One small question that might not belong in this mailing list:
Since all the binary commands share the same name, e.g. initdb, createdb,
psql, etc, and the
default path is already the 7.1.3 version. How do I come up a way to access
binary commands of
both versions quickly without adding absolute path infront of those of
7.4.1?

Well if you are using 7.4.1 primarily you can just change the path order
so that the pgsql/bin for 7.4.1 comes
before the pgsql/bin for 7.1.3. If not, you could set up some aliases...
if you are using bash:

alias psql74 = '/usr/local/pgsql74/bin/psql'

gcc's configure has a --program-prefix and a --program-suffix option so:

../configure --program-suffix=-3.4

would generate the binary:

gcc-3.4

instead of:

gcc

I wonder if people would find that useful for PostgreSQL? It doesn't
seem to be a particularly hot topic, though.

Mike Mascari


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 22 '05 #8
>>
gcc's configure has a --program-prefix and a --program-suffix option so:

./configure --program-suffix=-3.4

would generate the binary:

gcc-3.4

instead of:

gcc

I wonder if people would find that useful for PostgreSQL? It doesn't
seem to be a particularly hot topic, though.

Hah! I didn't even know you could do that... That could definately help
in some situations.

J
Mike Mascari

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandpromp t.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 22 '05 #9
I just set up two different accounts, one named pg73, one named pg74, for
instance, and run everything from there. This also lets you set
LD_LIBRARY_PATH for each one to be the right path, and not worry about
having it try to load the wrong shared libs.

On Fri, 6 Feb 2004, Wei Wang wrote:
Thank you all for your kind help. I have set up 7.4.1 and it's up and
running perfectly.
One small question that might not belong in this mailing list:
Since all the binary commands share the same name, e.g. initdb, createdb,
psql, etc, and the
default path is already the 7.1.3 version. How do I come up a way to access
binary commands of
both versions quickly without adding absolute path infront of those of
7.4.1?

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
14574
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
0
1800
by: Oliver Elphick | last post by:
The attached proposal is written primarily for Debian. Its motivation is that the current package upgrade process is pretty flaky and also that the current packaging does not really provide for multiple simultaneous postmasters, which are wanted by people hosting several database clusters. I assume these proposals may also be of interest...
6
1999
by: Conrad | last post by:
Greetings, In short: Using a new FreeBSD (4.9) PostgreSQL (7.3) server, can I rescue PostgreSQL data from a hard drive pulled from an older (motherboard just died) FreeBSD (4.??) PostgreSQL (7.??) server? If so, how? The long version:
1
3325
by: Richard Huxton | last post by:
On Thursday 12 February 2004 20:25, Prashanthi Muthyala wrote: > Hi Richard Hi Prashanthi - nice to hear from you again. I've taken the liberty of cc-ing the general list on this, since there may be others who can help here. > I am trying to migrate the database and its tables from mysql in my > windows machine to postgresql in my new red...
1
1508
by: Karam Chand | last post by:
Hello In my development area I want to install and run various versions of Postgresql on the same machine (sorry....but acute shortage of hardware) listening on different port. Is it possible? Any help...
12
1658
by: jao | last post by:
I have an application with a table that tracks objects with a "size" attribute. What we want to do is to periodically report on the number of these objects and the sum of the object sizes. The table will typically have 1-5 million rows. I know that the obvious "select count(*), sum(size) ..." is not a good idea, and we have seen the impact...
6
1719
by: Jean-Guillaume LALANNE | last post by:
Hi, I am pretty new to the postgresql community. My question may seem a little bit strange but I'd like to know if it is possible to run 2 postgresql processes with 2 separate databases on the same machine (change of the ports, different paths to logs, ...)? Thanks in advance for your answers.
0
1638
by: Greg Sabino Mullane | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This is a PGP-signed copy of the checksums for following PostgreSQL versions: 7.4.5 7.4.4 7.3.7
14
2581
by: jptpjs via AccessMonster.com | last post by:
I have an application I built in Access 2003. It is an electronic medical records program split into front end (8 computers) and back end. This runs flawlessly. Purchased a billing program that uses Postgresql. This resides on the same computer as our Access backend. We keep getting knocked out of the new billing program and never get knocked...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.