Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-58410

postgresql-setup --upgrade does not create the new cluster with the right collate/locale settings

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-8.10, CentOS Stream 8, CentOS Stream 9, rhel-9.4
    • postgresql
    • None
    • No
    • None
    • sst_cs_apps
    • ssg_core_services
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None

      What were you trying to do that didn't work?

      Upgrade PostgreSQL from 13 to 15 using postgresql-setup --upgrade

      What is the impact of this issue to you?

      Need to find out the values, and manually pass parameters to initdb via
      PGSETUP_INITDB_OPTIONS="--lc-collate=#{collate} --lc-ctype=#{ctype} --locale=#{locale}"

      Please provide the package NVR for which the bug is seen:

      postgresql-13.16-1.el9.x86_64 to postgresql-15.8-2.module_el9+1108+b05fe5f3.x86_64, but the same applies to any upgrade on EL8 and EL9

      Also I've not seen any changes related to that in https://github.com/devexp-db/postgresql-setup, so I'd expect the same will be valid on EL10 too.

      How reproducible is this bug?:

      100%

      Steps to reproduce

      [root@centos9-stream ~]# locale
      LANG=en_US.UTF-8
      LC_CTYPE="en_US.UTF-8"
      LC_NUMERIC="en_US.UTF-8"
      LC_TIME="en_US.UTF-8"
      LC_COLLATE="en_US.UTF-8"
      LC_MONETARY="en_US.UTF-8"
      LC_MESSAGES="en_US.UTF-8"
      LC_PAPER="en_US.UTF-8"
      LC_NAME="en_US.UTF-8"
      LC_ADDRESS="en_US.UTF-8"
      LC_TELEPHONE="en_US.UTF-8"
      LC_MEASUREMENT="en_US.UTF-8"
      LC_IDENTIFICATION="en_US.UTF-8"
      LC_ALL=
      
      [root@centos9-stream ~]# rpm -qa |grep postgres
      postgresql-private-libs-13.16-1.el9.x86_64
      postgresql-13.16-1.el9.x86_64
      postgresql-server-13.16-1.el9.x86_64
      
      [root@centos9-stream ~]# postgresql-setup --initdb
       * Initializing database in '/var/lib/pgsql/data'
       * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
      [root@centos9-stream ~]# systemctl start postgresql
      [root@centos9-stream ~]# su - postgres
      [postgres@centos9-stream ~]$ psql --list
                                        List of databases
         Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
      -----------+----------+----------+-------------+-------------+-----------------------
       postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
       template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                 |          |          |             |             | postgres=CTc/postgres
       template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                 |          |          |             |             | postgres=CTc/postgres
      (3 rows)
      
      [root@centos9-stream ~] echo 'LANG="en_GB.UTF-8"' > /etc/locale.conf
      <relogin dance>
      
      [root@centos9-stream ~]# locale
      LANG=en_GB.UTF-8
      LC_CTYPE="en_GB.UTF-8"
      LC_NUMERIC="en_GB.UTF-8"
      LC_TIME="en_GB.UTF-8"
      LC_COLLATE="en_GB.UTF-8"
      LC_MONETARY="en_GB.UTF-8"
      LC_MESSAGES="en_GB.UTF-8"
      LC_PAPER="en_GB.UTF-8"
      LC_NAME="en_GB.UTF-8"
      LC_ADDRESS="en_GB.UTF-8"
      LC_TELEPHONE="en_GB.UTF-8"
      LC_MEASUREMENT="en_GB.UTF-8"
      LC_IDENTIFICATION="en_GB.UTF-8"
      LC_ALL=
      
      [root@centos9-stream ~]# dnf module enable postgresql:15
      [root@centos9-stream ~]# dnf upgrade
      [root@centos9-stream ~]# dnf install postgresql-upgrade
      
      [root@centos9-stream ~]# rpm -qa |grep postgres
      postgresql-private-libs-15.8-2.module_el9+1108+b05fe5f3.x86_64
      postgresql-15.8-2.module_el9+1108+b05fe5f3.x86_64
      postgresql-server-15.8-2.module_el9+1108+b05fe5f3.x86_64
      postgresql-upgrade-15.8-2.module_el9+1108+b05fe5f3.x86_64
      
      
      [root@centos9-stream ~]# postgresql-setup --upgrade
       * Upgrading database.
      ERROR: pg_upgrade tool failed
      ERROR: Upgrade failed.
       * See /var/lib/pgsql/upgrade_postgresql.log for details.
      
      [root@centos9-stream ~]# cat /var/lib/pgsql/upgrade_postgresql.log
      Performing Consistency Checks
      -----------------------------
      Checking cluster versions                                   ok
      Checking database user is the install user                  ok
      Checking database connection settings                       ok
      Checking for prepared transactions                          ok
      Checking for system-defined composite types in user tables  ok
      Checking for reg* data types in user tables                 ok
      Checking for contrib/isn with bigint-passing mismatch       ok
      Checking for user-defined encoding conversions              ok
      Checking for user-defined postfix operators                 ok
      Checking for incompatible polymorphic functions             ok
      Creating dump of global objects                             ok
      Creating dump of database schemas                           ok
      
      lc_collate values for database "template1" do not match:  old "en_US.UTF-8", new "en_GB.UTF-8"
      Failure, exiting
      

      Expected results

      Cluster is upgraded to PostgreSQL 15 without me having to manually find out and pass collation etc parameters.

      Actual results

      lc_collate values for database "template1" do not match:  old "en_US.UTF-8", new "en_GB.UTF-8"

            fjanus@redhat.com Filip Janus
            egolov@redhat.com Evgeni Golov
            Filip Janus Filip Janus
            bot rhel-cs-apps-subsystem-qe bot rhel-cs-apps-subsystem-qe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: