Re: Bash profile - Mailing list pgsql-general

From Yongye Serkfem
Subject Re: Bash profile
Date
Msg-id CAAu_hGsPXp3Yn+WdZHLT+t3MXHgHSp+FSUqcu5G=O7oRrm9+GQ@mail.gmail.com
Whole thread Raw
In response to Re: Bash profile  (Ron Johnson <ronljohnsonjr@gmail.com>)
Responses Re: Bash profile
Re: Bash profile
List pgsql-general

I am upgrading from version 12.7 to 15.7

On Sat, Feb 15, 2025, 2:15 PM Ron Johnson <ronljohnsonjr@gmail.com> wrote:
On Sat, Feb 15, 2025 at 2:01 PM Yongye Serkfem <yserkfem@gmail.com> wrote:
Hi Everyone!
I would appreciate any assistance with configuring the bash profile to run two different postgresql versions. Specifically V12.7 and 15.7

Create a bash function that exports PGDATA to the relevant directory, based on the parameter you pass.
Add as much error checking (to ensure that the parameter you passed actually points to a real data dir and that the postmaster is running.  How you do that depends on whether it's Debian-based, RH-based or something else.

We, for example, have standardized on data directories in the format:
/Database/<MajorVer>/data

Thus, something as simple as this would work for us:
pgswitch() { export PGDATA=/Database/${1}/data ; }

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Bash profile
Next
From: Ron Johnson
Date:
Subject: Re: Bash profile