Subject: patch postgres user .bash_profile

From: Pierre-Alain TORET <[email-masked]>
Date: Fri, 08 Dec 2017 06:17:12 -0500

​Hello,

First, thanks a lot for the packaging job you're doing with PostgreSQL :)

I'm sending you a little patch to improve a the usability of the user postgres by adding the binaries to the PATH variable in its .bash_profile.

Don't hesitate to comment or criticize but I think it will make the life of user easier, especially those installing the package for the first time.

I modified the file called postgresql-10-bashprofile, but from what I've seen it's not used yet in the spec file.

Regards,
From b34f6f24d9dad1c383e2ad975d202d09ede180a4 Mon Sep 17 00:00:00 2001
From: Pierre-Alain TORET <[email-masked]>
Date: Fri, 8 Dec 2017 11:37:36 +0100
Subject: [PATCH] Add the path to binaries to postgres user .bash_profile

Signed-off-by: Pierre-Alain TORET <[email-masked]>
---
 rpm/redhat/10/postgresql/master/postgresql-10-bashprofile | 2 ++
 rpm/redhat/9.2/postgresql/EL-5/postgresql-9.2.spec        | 2 ++
 rpm/redhat/9.2/postgresql/EL-6/postgresql-9.2.spec        | 2 ++
 rpm/redhat/9.2/postgresql/EL-7/postgresql-9.2.spec        | 2 ++
 rpm/redhat/9.3/postgresql/EL-5/postgresql-9.3.spec        | 2 ++
 rpm/redhat/9.3/postgresql/EL-6/postgresql-9.3.spec        | 2 ++
 rpm/redhat/9.3/postgresql/EL-7/postgresql-9.3.spec        | 2 ++
 rpm/redhat/9.4/postgresql/EL-5/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.4/postgresql/EL-6/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.4/postgresql/EL-7/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.4/postgresql/F-24/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.4/postgresql/F-25/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.4/postgresql/F-26/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.4/postgresql/F-27/postgresql-9.4.spec        | 2 ++
 rpm/redhat/9.5/postgresql/master/postgresql-9.5.spec      | 2 ++
 rpm/redhat/9.6/postgresql/master/postgresql-9.6.spec      | 2 ++
 16 files changed, 32 insertions(+)

diff --git a/rpm/redhat/10/postgresql/master/postgresql-10-bashprofile b/rpm/redhat/10/postgresql/master/postgresql-10-bashprofile
index 138d2d211..fc68ecf41 100644
--- a/rpm/redhat/10/postgresql/master/postgresql-10-bashprofile
+++ b/rpm/redhat/10/postgresql/master/postgresql-10-bashprofile
@@ -1,5 +1,7 @@
 [ -f /etc/profile ] && source /etc/profile
 
+PATH=/usr/pgsql-10/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/10/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.2/postgresql/EL-5/postgresql-9.2.spec b/rpm/redhat/9.2/postgresql/EL-5/postgresql-9.2.spec
index 03965a0fe..384e13a5d 100644
--- a/rpm/redhat/9.2/postgresql/EL-5/postgresql-9.2.spec
+++ b/rpm/redhat/9.2/postgresql/EL-5/postgresql-9.2.spec
@@ -527,6 +527,8 @@ chkconfig --add postgresql-9.2
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.2/postgresql/EL-6/postgresql-9.2.spec b/rpm/redhat/9.2/postgresql/EL-6/postgresql-9.2.spec
index 38d9c21e1..6dd663fa6 100644
--- a/rpm/redhat/9.2/postgresql/EL-6/postgresql-9.2.spec
+++ b/rpm/redhat/9.2/postgresql/EL-6/postgresql-9.2.spec
@@ -532,6 +532,8 @@ chkconfig --add postgresql-%{majorversion}
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.2/postgresql/EL-7/postgresql-9.2.spec b/rpm/redhat/9.2/postgresql/EL-7/postgresql-9.2.spec
index 508d18b74..0e6896510 100644
--- a/rpm/redhat/9.2/postgresql/EL-7/postgresql-9.2.spec
+++ b/rpm/redhat/9.2/postgresql/EL-7/postgresql-9.2.spec
@@ -589,6 +589,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.3/postgresql/EL-5/postgresql-9.3.spec b/rpm/redhat/9.3/postgresql/EL-5/postgresql-9.3.spec
index 4dfb406d8..e08dee225 100644
--- a/rpm/redhat/9.3/postgresql/EL-5/postgresql-9.3.spec
+++ b/rpm/redhat/9.3/postgresql/EL-5/postgresql-9.3.spec
@@ -529,6 +529,8 @@ chkconfig --add postgresql-9.3
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.3/postgresql/EL-6/postgresql-9.3.spec b/rpm/redhat/9.3/postgresql/EL-6/postgresql-9.3.spec
index b2f3479a5..832ee230b 100644
--- a/rpm/redhat/9.3/postgresql/EL-6/postgresql-9.3.spec
+++ b/rpm/redhat/9.3/postgresql/EL-6/postgresql-9.3.spec
@@ -534,6 +534,8 @@ chkconfig --add postgresql-9.3
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.3/postgresql/EL-7/postgresql-9.3.spec b/rpm/redhat/9.3/postgresql/EL-7/postgresql-9.3.spec
index 4f34cdfbd..361adbf22 100644
--- a/rpm/redhat/9.3/postgresql/EL-7/postgresql-9.3.spec
+++ b/rpm/redhat/9.3/postgresql/EL-7/postgresql-9.3.spec
@@ -592,6 +592,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/EL-5/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/EL-5/postgresql-9.4.spec
index def253969..c2a946560 100644
--- a/rpm/redhat/9.4/postgresql/EL-5/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/EL-5/postgresql-9.4.spec
@@ -530,6 +530,8 @@ chkconfig --add postgresql-%{majorversion}
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/EL-6/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/EL-6/postgresql-9.4.spec
index 4790f8e60..4e8a21c99 100644
--- a/rpm/redhat/9.4/postgresql/EL-6/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/EL-6/postgresql-9.4.spec
@@ -535,6 +535,8 @@ chkconfig --add postgresql-%{majorversion}
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/EL-7/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/EL-7/postgresql-9.4.spec
index 2c587e61f..b34eec0d6 100644
--- a/rpm/redhat/9.4/postgresql/EL-7/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/EL-7/postgresql-9.4.spec
@@ -600,6 +600,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/F-24/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/F-24/postgresql-9.4.spec
index 2e1f174b1..64f50ce28 100644
--- a/rpm/redhat/9.4/postgresql/F-24/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/F-24/postgresql-9.4.spec
@@ -600,6 +600,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/F-25/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/F-25/postgresql-9.4.spec
index fe8976927..6c6312cd4 100644
--- a/rpm/redhat/9.4/postgresql/F-25/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/F-25/postgresql-9.4.spec
@@ -599,6 +599,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/F-26/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/F-26/postgresql-9.4.spec
index 2e1f174b1..64f50ce28 100644
--- a/rpm/redhat/9.4/postgresql/F-26/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/F-26/postgresql-9.4.spec
@@ -600,6 +600,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.4/postgresql/F-27/postgresql-9.4.spec b/rpm/redhat/9.4/postgresql/F-27/postgresql-9.4.spec
index 2e1f174b1..64f50ce28 100644
--- a/rpm/redhat/9.4/postgresql/F-27/postgresql-9.4.spec
+++ b/rpm/redhat/9.4/postgresql/F-27/postgresql-9.4.spec
@@ -600,6 +600,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.5/postgresql/master/postgresql-9.5.spec b/rpm/redhat/9.5/postgresql/master/postgresql-9.5.spec
index b6136d4fb..20e28d9a3 100644
--- a/rpm/redhat/9.5/postgresql/master/postgresql-9.5.spec
+++ b/rpm/redhat/9.5/postgresql/master/postgresql-9.5.spec
@@ -939,6 +939,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{majorversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{majorversion}/data
 export PGDATA
 # If you want to customize your settings,
diff --git a/rpm/redhat/9.6/postgresql/master/postgresql-9.6.spec b/rpm/redhat/9.6/postgresql/master/postgresql-9.6.spec
index 10d6fdb19..a396fb3c8 100644
--- a/rpm/redhat/9.6/postgresql/master/postgresql-9.6.spec
+++ b/rpm/redhat/9.6/postgresql/master/postgresql-9.6.spec
@@ -925,6 +925,8 @@ fi
 # We now don't install .bash_profile as we used to in pre 9.0. Instead, use cat,
 # so that package manager will be happy during upgrade to new major version.
 echo "[ -f /etc/profile ] && source /etc/profile
+PATH=/usr/pgsql-%{pgpackageversion}/bin/:$PATH
+export PATH
 PGDATA=/var/lib/pgsql/%{pgpackageversion}/data
 export PGDATA
 # If you want to customize your settings,
-- 
2.14.3

---

From: Devrim Gündüz <[email-masked]>
Date: Sun, 10 Dec 2017 22:21:45 +0300

Hi,

On Fri, 2017-12-08 at 06:17 -0500, Pierre-Alain TORET wrote:
> I'm sending you a little patch to improve a the usability of the user
> postgres by adding the binaries to the PATH variable in its .bash_profile.
> 
> Don't hesitate to comment or criticize but I think it will make the life of
> user easier, especially those installing the package for the first time.

Thanks for the patch.

The policy is adding the binaries which are cross-version compatible under
$PATH (/usr/bin in this case), and keep others in their own directories. Your
patch will probably break the latter, because we want users to specify full
path of the "other" binaries, so that things won't be broken.

So, unfortunately I will reject this.

Regards,
-- 
Devrim Gündüz
EnterpriseDB: https://www.enterprisedb.com
PostgreSQL Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

---

From: Pierre-Alain TORET <[email-masked]>
Date: Mon, 11 Dec 2017 05:00:35 -0500

Devrim,
​
>-------- Original Message --------
>Subject: Re: patch postgres user .bash_profile
>Local Time: 10 December 2017 8:21 PM
>UTC Time: 10 December 2017 19:21
>From: [email-masked]
>To: Pierre-Alain TORET <[email-masked]>, [email-masked] <[email-masked]>
>
>

Thanks for your explanations, this makes perfect sense in rejecting this patch.
Sorry for the noise.

Regards,