# Psql is bug？this issue was also encountered in postgresql 16.3

**URL:** https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608
**Category:** Percona Distribution for PostgreSQL
**Created:** [July 15, 2024, 9:29am UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608 "2024-07-15T09:29:26Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 15, 2024, 9:29am UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/1 "2024-07-15T09:29:26Z")

</div>

[postgres@ora23ai ~]$ psql  
psql (15.7)

Type “help” for help.  
malloc(): corrupted top size  
Aborted (core dumped)

- saw the same core dump file from the /var/log/messages

[root@ora23ai ~]# coredumpctl list

TIME PID UID GID SIG COREFILE EXE  
Sun 2024-07-14 14:36:44 UTC 5267 1001 1001 6 none /usr/local/postgresql/percona-postgresql15/bin/psql  
Sun 2024-07-14 14:40:06 UTC 5338 1001 1001 6 present /usr/local/postgresql/percona-postgresql15/bin/psql

```auto
[root@ora23ai ~]# coredumpctl info
   Timestamp: Sun 2024-07-14 14:40:06 UTC (11min ago)
  Command Line: psql
    Executable: /usr/local/postgresql/percona-postgresql15/bin/psql
 Control Group: /user.slice/user-0.slice/session-3.scope
          Unit:
         Slice: user-0.slice
       Session: 3
     Owner UID: 0 (root)
       Boot ID: 348f8a837b8441cb92b0b671399640c9
    Machine ID: be412bd3b0e64ca9a93910d1db40d078
      Hostname: ora23ai
       Storage: /var/lib/systemd/coredump/core.psql.1001.348f8a837b8441cb92b0b671399640c9.5338.1720968006000000.lz4
       Message: Process 5338 (psql) of user 1001 dumped core.
                Stack trace of thread 5338:
                #0 0x00007fb50b66452f raise (libc.so.6)
                #1 0x00007fb50b637e65 abort (libc.so.6)
                #2 0x00007fb50b6a5727 __libc_message (libc.so.6)
                #3 0x00007fb50b6aca2c malloc_printerr (libc.so.6)
                #4 0x00007fb50b6b0208 _int_malloc (libc.so.6)
                #5 0x00007fb50b6b126e malloc (libc.so.6)
                #6 0x00007fb50c1c758d history_def_insert (libedit.so)
                #7 0x00007fb50c1c7a85 history_load (libedit.so)
                #8 0x00007fb50c1d22a0 read_history (libedit.so)
                #9 0x000000000041ff8b initializeInput (psql)
                #10 0x0000000000405346 main (psql)
                #11 0x00007fb50b6507e5 __libc_start_main (libc.so.6)
                #12 0x000000000040544e _start (psql)

```

- after i deleted .psql\_history ,then psql works fine, it is shown below.

[postgres@ora23ai ~]$ rm -rf .psql\_history  
[root@ora23ai ~]# su - postgres  
Last login: Sun Jul 14 14:47:28 UTC 2024 on pts/0  
[postgres@ora23ai ~]$ psql  
psql (15.7)  
Type “help” for help.  
postgres=#  
postgres=# \q

but i found that another problem arose.

```auto
could not save history to file "/home/postgres/.psql_history": Success

ll /home/postgres/.psql_history
-rw------- 1 postgres postgres 20 Jul 14 14:49 .psql_history

```

more additional information.

```auto
[postgres@ora23ai ~]$ ps -efa|grep postgres
ps: /opt/pgdistro/percona-postgresql16/lib/libuuid.so.1: no version information available (required by /lib64/libblkid.so.1)
postgres 3404 1 0 15:28 ? 00:00:00 /opt/pgdistro/percona-postgresql16/bin/postgres -D /pgdata
postgres 3405 3404 0 15:28 ? 00:00:00 postgres: checkpointer
postgres 3406 3404 0 15:28 ? 00:00:00 postgres: background writer
postgres 3408 3404 0 15:28 ? 00:00:00 postgres: walwriter
postgres 3409 3404 0 15:28 ? 00:00:00 postgres: autovacuum launcher
postgres 3410 3404 0 15:28 ? 00:00:00 postgres: logical replication launcher
root 6462 2986 0 16:56 pts/0 00:00:00 su - postgres
postgres 6463 6462 0 16:56 pts/0 00:00:00 -bash
postgres 6552 6463 0 17:04 pts/0 00:00:00 ps -efa
postgres 6553 6463 0 17:04 pts/0 00:00:00 grep --color=auto postgres

[postgres@ora23ai ~]$ cat /etc/redhat-release
AlmaLinux release 8.9 (Midnight Oncilla)

```

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 15, 2024, 9:33am UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/2 "2024-07-15T09:33:19Z")

</div>

- A little additional information.

```auto
[postgres@ora23ai ~]$ ps -efa|pgrep postgres
ps: /opt/pgdistro/percona-postgresql16/lib/libuuid.so.1: no version information available (required by /lib64/libblkid.so.1)
pgrep: /opt/pgdistro/percona-postgresql16/lib/libuuid.so.1: no version information available (required by /lib64/libblkid.so.1)
3404
3405
3406
3408
3409
3410
6617
[postgres@ora23ai ~]$ ll /lib64/libblkid.so.1
lrwxrwxrwx 1 root root 17 Apr 6 21:02 /lib64/libblkid.so.1 -> libblk

```

# windows 1

## postgres=# select pg\_backend\_pid(); pg\_backend\_pid

```
       6617

```

(1 row)

## postgres=# select version(); version

PostgreSQL 16.3 on x86\_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22.0.1), 64-bit  
(1 row)

postgres=# \q  
could not save history to file “/home/postgres/.psql\_history”: Success

# windows 2

[postgres@ora23ai ~]$ strace -p 6617  
strace: Process 6617 attached  
epoll\_wait(5, [{events=EPOLLIN, data={u32=28714904, u64=28714904}}], 1, -1) = 1  
recvfrom(9, “Q\0\0\0\26select version();\0”, 8192, 0, NULL, NULL) = 23  
sendto(9, “T\0\0\0 \0\1version\0\0\0\0\0\0\0\0\0\0\31\377\377\377\377\377\377\0”…, 171, 0, NULL, 0) = 171  
recvfrom(9, 0xe492e0, 8192, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)  
epoll\_wait(5, [{events=EPOLLIN|EPOLLHUP, data={u32=28714904, u64=28714904}}], 1, -1) = 1  
recvfrom(9, “X\0\0\0\4”, 8192, 0, NULL, NULL) = 5  
getpid() = 6617  
munmap(0x7fa6f4dc5000, 1048576) = 0  
getpid() = 6617  
futex(0x7fa6f4522344, FUTEX\_WAKE\_PRIVATE, 2147483647) = 0  
exit\_group(0) = ?  
+++ exited with 0 +++

```auto

```

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 16, 2024, 2:18pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/3 "2024-07-16T14:18:25Z")

</div>

Hi,

I tried without success to reproduce the error, see below.

I noticed you were using AlmaLinux version 8. I ran my test in an incus container. At a guess, and it’s only a guess, I’d first confirm that you’ve installed postgres on a viable OS.

Hope this helps.

```auto
incus launch images:almalinux/8 tmp-alma1
incus exec tmp-alma1 -- su -

```

```auto
#
# INSTALL pg16, x86_64
# https://www.postgresql.org/download/linux/redhat/
#
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
sudo dnf install -y postgresql16-server
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
sudo systemctl enable postgresql-16
sudo systemctl start postgresql-16

```

```auto
#
# VALIDATION
#
dnf install -y net-tools
netstat -tlnp

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 3172/postgres
tcp6 0 0 ::1:5432 :::* LISTEN 3172/postgres

```

```auto
su - postgres
psql (PostgreSQL) 16.3
[postgres@tmp-alma1 ~]$ psql
psql (16.3)
Type "help" for help.

```

```auto
postgres=# select version();
                                                 version
---------------------------------------------------------------------------------------------------------
 PostgreSQL 16.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22), 64-bit
(1 row)

```

```auto
postgres=# \q
[postgres@tmp-alma1 ~]$ logout
[root@tmp-alma1 ~]# coredumpctl list
No coredumps found.

```

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 16, 2024, 2:21pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/4 "2024-07-16T14:21:49Z")

</div>

Apologies, I didn’t ask but I assumed you were using vanilla postgres. I’ll repeat the test with our Percona distro of postgres.

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 16, 2024, 2:42pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/5 "2024-07-16T14:42:58Z")

</div>

Thinks, i’m having this issue in both Percona Distribution for PostgreSQL 15.7 and Percona Distribution for PostgreSQL 16.3 and it’s easy to reproduce.

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 16, 2024, 2:44pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/6 "2024-07-16T14:44:30Z")

</div>

As per my last post, I reran the [installation](https://docs.percona.com/postgresql/16/yum.html#install-packages). No issues were found. Please note as there was no Alma Linux 8 available **Rocky LInux 8** was used instead.

Hope this helps 🙂

AS ROOT

```auto
# -------------------
# PART 1
dnf module disable postgresql llvm-toolset
dnf install dnf-plugins-core
dnf module enable llvm-toolset
dnf config-manager --set-enabled powertools

```

```auto
# -------------------
# PART 2
yum -y install curl
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
percona-release setup ppg16
yum install percona-ppg-server16

```

```auto

```

```auto
# -------------------
# PART 3
/usr/pgsql-16/bin/postgresql-16-setup initdb
systemctl start postgresql-16

```

```auto

```

```auto
# -------------------
# PART 4
dnf install -y mlocate net-tools man
mandb && updatedb
netstat -tlnp

```

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 16, 2024, 2:53pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/7 "2024-07-16T14:53:06Z")

</div>

Just to be clear.

- test 1: vanilla pg installed on alma linux 8
- test 2: percona pg installed on alma linux 8 using the Percona Rocky Linux 8 distro

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 16, 2024, 3:00pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/8 "2024-07-16T15:00:23Z")

</div>

I’m install Percona Distribiution for PostgreSQL from binary tarballs .the link is below  
[https://docs.percona.com/postgresql/16/tarball.html](https://docs.percona.com/postgresql/16/tarball.html)

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 16, 2024, 4:48pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/9 "2024-07-16T16:48:01Z")

</div>

Right then, 3X’s the charm!

What I’m documenting below should work for you. The tarball you used is not the correct one as it assumes you have SSL ver 3 which doesn’t appear to be on a base install of Alma Linux 8.

Goto this [URL](https://www.percona.com/downloads) for the correct tarball and after choosing pg 16 download this one  
**percona-postgresql-16.3-ssl1.1-linux-x86\_64.tar.gz**

Now here’s the instructions I used. It’s slightly different then the documentation originally references but its far simpler IMHO.

```auto
#
# ALMALINUX 8
# Some of these aren't needed but I find them useful
#   
dnf install -y mlocate man net-tools wget curl mc tar vim

```

```auto
adduser percona -p percona
su - percona
mkdir postgres data
cd postgres

```

```auto
# download and extract
tar -xzpvf percona-postgresql-16.3-ssl1.1-linux-x86_64.tar.gz

```

```auto
#
# update resource files, elminate the long path invocations
# next time you login
#
echo "
if [-f ~/.bash_aliases]; then
    . ~/.bash_aliases
fi
" >> $HOME/.bashrc

echo "
export PATH=:$HOME/postgres/percona-haproxy/sbin/:$HOME/postgres/percona-patroni/bin/:$HOME/postgres/percona-pgbackrest/bin/:$HOME/postgres/percona-pgbadger/:$HOME/postgres/percona-pgbouncer/bin/:$HOME/postgres/percona-pgpool-II/bin/:$HOME/postgres/percona-postgresql16/bin/:$HOME/postgres/percona-etcd/bin/:/opt/percona-perl/bin/:/opt/percona-tcl/bin/:/opt/percona-python3/bin/:$PATH
" > $HOME/.bash_aliases

```

```auto
# initialize cluster, remember to logout 
# and back in in order to update the PATH environment variable
#
initdb -D $HOME/data

```

```auto
# start cluster
pg_ctl start -D $HOME/data -l logfile

```

```auto
# login
psql

```

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 17, 2024, 12:13am UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/10 "2024-07-17T00:13:59Z")

</div>

I’m so sorry i should have said more about the environment.

```auto
[postgres@ora23ai ~]$ ll percona-postgresql-1*
-rw-r--r-- 1 postgres postgres 270884083 Jun 5 18:21 percona-postgresql-15.7-ssl1.1-linux-x86_64.tar.gz
-rw-r--r-- 1 postgres postgres 273228701 Jun 5 18:23 percona-postgresql-16.3-ssl1.1-linux-x86_64.tar.gz

[postgres@ora23ai ~]$ openssl version
OpenSSL 1.1.1k FIPS 25 Mar 2021
[postgres@ora23ai ~]$ ll /opt/pgdistro/
total 0
drwxr-xr-x 3 postgres postgres 17 Jun 5 18:39 percona-etcd
drwxr-xr-x 7 postgres postgres 64 Jun 5 18:39 percona-haproxy
drwxr-xr-x 4 postgres postgres 53 Jun 5 18:38 percona-patroni
drwxr-xr-x 5 postgres postgres 39 Jun 5 18:25 percona-perl
drwxr-xr-x 5 postgres postgres 65 Jun 5 18:38 percona-pgbackrest
drwxr-xr-x 3 postgres postgres 85 Jun 5 18:38 percona-pgbadger
drwxr-xr-x 6 postgres postgres 52 Jun 5 18:37 percona-pgbouncer
drwxr-xr-x 7 postgres postgres 67 Jun 5 18:37 percona-pgpool-II
drwxr-xr-x 7 postgres postgres 67 Jun 5 18:37 percona-postgresql16
drwxr-xr-x 6 postgres postgres 56 Jun 5 18:29 percona-python3
drwxr-xr-x 7 postgres postgres 67 Jun 5 18:31 percona-tcl

```

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 17, 2024, 1:10pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/11 "2024-07-17T13:10:06Z")

</div>

if you’re still having problems then I suggest you reinstall everything on another completely different OS/machine in order to eliminate that the issues is related to the operating system.

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 17, 2024, 1:52pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/12 "2024-07-17T13:52:37Z")

</div>

I have performed the installation of the recommended OS for ppg16.

```auto
[root@rocky8 ~]# cat /etc/redhat-release
Rocky Linux release 8.9 (Green Obsidian)
[root@rocky8 ~]# openssl version
OpenSSL 1.1.1k FIPS 25 Mar 2021
[root@rocky8 ~]# useradd postgres -m
[root@rocky8 ~]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@rocky8 ~]# su - postgres
[root@rocky8 ~]# chown -R postgres:postgres /home/postgres/percona-postgresql-16.3-ssl1.1-linux-x86_64.tar.gz
[root@rocky8 ~]# su - postgres
[root@rocky8 ~]# mkdir -p /usr/local/pgsql16.3
[root@rocky8 local]# ln -s /usr/local/pgsql16.3 /usr/local/pgsql
[root@rocky8 local]# ll
total 0
drwxr-xr-x. 2 root root 6 Oct 11 2021 bin
drwxr-xr-x. 2 root root 6 Oct 11 2021 etc
drwxr-xr-x. 2 root root 6 Oct 11 2021 games
drwxr-xr-x. 2 root root 6 Oct 11 2021 include
drwxr-xr-x. 2 root root 6 Oct 11 2021 lib
drwxr-xr-x. 3 root root 17 Jan 10 2024 lib64
drwxr-xr-x. 2 root root 6 Oct 11 2021 libexec
lrwxrwxrwx. 1 root root 20 Jul 17 13:33 pgsql -> /usr/local/pgsql16.3
drwxr-xr-x. 2 root root 6 Jul 17 13:32 pgsql16.3
drwxr-xr-x. 2 root root 6 Oct 11 2021 sbin
drwxr-xr-x. 5 root root 49 Jan 10 2024 share
drwxr-xr-x. 2 root root 6 Oct 11 2021 src
[root@rocky8 pgsql]# tar xf /home/postgres/percona-postgresql-16.3-ssl1.1-linux-x86_64.tar.gz -C ./
[root@rocky8 local]# chown -R postgres:postgres pgsql
[root@rocky8 local]# chown -R postgres:postgres pgsql16.3

[root@rocky8 pgsql]# cp -r percona-perl percona-python3 percona-tcl /opt/
[root@rocky8 pgsql]# ll /opt
total 0
drwxr-xr-x. 5 root root 39 Jul 17 13:36 percona-perl
drwxr-xr-x. 6 root root 56 Jul 17 13:36 percona-python3
drwxr-xr-x. 7 root root 67 Jul 17 13:36 percona-tcl
drwxr-xr-x. 8 root root 136 Jan 10 2024 VBoxGuestAdditions-6.1.30
[root@rocky8 pgsql]# chown -R postgres:postgres /opt/percona-*
[root@rocky8 pgsql]# ll
total 0
drwxr-xr-x. 3 postgres postgres 17 Jun 5 10:39 percona-etcd
drwxr-xr-x. 7 postgres postgres 64 Jun 5 10:39 percona-haproxy
drwxr-xr-x. 4 postgres postgres 53 Jun 5 10:38 percona-patroni
drwxr-xr-x. 5 postgres postgres 39 Jun 5 10:25 percona-perl
drwxr-xr-x. 5 postgres postgres 65 Jun 5 10:38 percona-pgbackrest
drwxr-xr-x. 3 postgres postgres 85 Jun 5 10:38 percona-pgbadger
drwxr-xr-x. 6 postgres postgres 52 Jun 5 10:37 percona-pgbouncer
drwxr-xr-x. 7 postgres postgres 67 Jun 5 10:37 percona-pgpool-II
drwxr-xr-x. 7 postgres postgres 67 Jun 5 10:37 percona-postgresql16
drwxr-xr-x. 6 postgres postgres 56 Jun 5 10:29 percona-python3
drwxr-xr-x. 7 postgres postgres 67 Jun 5 10:31 percona-tcl
[root@rocky8 pgsql]# ll /opt
total 0
drwxr-xr-x. 5 postgres postgres 39 Jul 17 13:36 percona-perl
drwxr-xr-x. 6 postgres postgres 56 Jul 17 13:36 percona-python3
drwxr-xr-x. 7 postgres postgres 67 Jul 17 13:36 percona-tcl
drwxr-xr-x. 8 root root 136 Jan 10 2024 VBoxGuestAdditions-6.1.30
[root@rocky8 pgsql]# cd
[root@rocky8 ~]# su - postgres
Last login: Wed Jul 17 13:35:24 UTC 2024 on pts/0
[postgres@rocky8 ~]$ vim .bash_profile
[postgres@rocky8 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [-f ~/.bashrc]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

export PATH=:/usr/local/pgsql/percona-haproxy/sbin/:/usr/local/pgsql/percona-patroni/bin/:/usr/local/pgsql/percona-pgbackrest/bin/:/usr/local/pgsql/percona-pgbadger/:/usr/local/pgsql/percona-pgbouncer/bin/:/usr/local/pgsql/percona-pgpool-II/bin/:/usr/local/pgsql/percona-postgresql16/bin/:/usr/local/pgsql/percona-etcd/bin/:/opt/percona-perl/bin/:/opt/percona-tcl/bin/:/opt/percona-python3/bin/:$PATH
[postgres@rocky8 ~]$ source .bash_profile
[postgres@rocky8 ~]$ exit
logout
[root@rocky8 ~]# mkdir /pgdata
[root@rocky8 ~]# chown postgres:postgres /pgdata/
[root@rocky8 ~]# su - postgres
Last login: Wed Jul 17 13:36:53 UTC 2024 on pts/0
[postgres@rocky8 ~]$ initdb -D /pgdata/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /pgdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /pgdata/ -l logfile start

[postgres@rocky8 ~]$
[postgres@rocky8 ~]$
[postgres@rocky8 ~]$
[postgres@rocky8 ~]$ pg_ctl -D /pgdata/ -l logfile start
waiting for server to start.... done
server started
[postgres@rocky8 ~]$ psql
psql (16.3)
Type "help" for help.

postgres=#
postgres=#
postgres=#
postgres=# \q
could not save history to file "/home/postgres/.psql_history": Success
[postgres@rocky8 ~]$
[postgres@rocky8 ~]$ cat /etc/redhat-release
Rocky Linux release 8.9 (Green Obsidian)
[postgres@rocky8 ~]$ psql
psql (16.3)
Type "help" for help.

postgres=# WITH cur_vaccs AS (
postgres(# SELECT split_part(split_part(substring(query from '.*..*'), '.', 2), ' ', 1) AS tab
postgres(# FROM pg_stat_activity
postgres(# WHERE query LIKE 'autovacuum%'
postgres(# )
postgres-# SELECT 'VACUUM (FREEZE, ANALYZE) "'|| n.nspname ||'"."' || c.relname ||'";'
postgres-# FROM pg_class c
postgres-# JOIN pg_namespace n ON c.relnamespace = n.oid
postgres-# LEFT JOIN pg_class t ON c.reltoastrelid = t.oid AND t.relkind = 't'
postgres-# WHERE c.relkind IN ('r', 'm') AND NOT EXISTS (
postgres(# SELECT * FROM cur_vaccs WHERE tab = c.relname
postgres(# )
postgres-# ORDER BY GREATEST(age(c.relfrozenxid), age(t.relfrozenxid)) DESC
postgres-# LIMIT 100;
                                 ?column?
--------------------------------------------------------------------------
 VACUUM (FREEZE, ANALYZE) "information_schema"."sql_sizing";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_type";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_foreign_table";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_authid";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_statistic_ext_data";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_user_mapping";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_subscription";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_attribute";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_proc";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_class";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_attrdef";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_constraint";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_inherits";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_index";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_operator";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_opfamily";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_opclass";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_am";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_amop";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_amproc";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_language";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_largeobject_metadata";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_aggregate";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_statistic_ext";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_rewrite";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_trigger";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_event_trigger";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_description";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_cast";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_enum";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_namespace";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_conversion";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_depend";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_statistic";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_db_role_setting";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_tablespace";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_auth_members";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_shdepend";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_shdescription";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_ts_config";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_ts_config_map";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_ts_dict";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_ts_parser";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_ts_template";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_extension";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_foreign_data_wrapper";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_foreign_server";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_policy";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_replication_origin";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_default_acl";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_init_privs";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_seclabel";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_shseclabel";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_collation";
 VACUUM (FREEZE, ANALYZE) "pg_catalog"."pg_parameter_acl";
postgres=# \q
could not save history to file "/home/postgres/.psql_history": Success
[postgres@rocky8 ~]$ psql
psql (16.3)
Type "help" for help.

malloc(): invalid size (unsorted)
Aborted (core dumped)
[postgres@rocky8 ~]$
[postgres@rocky8 ~]$ ll /pgdata/
total 64
drwx------. 5 postgres postgres 33 Jul 17 13:39 base
drwx------. 2 postgres postgres 4096 Jul 17 13:42 global
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_commit_ts
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_dynshmem
-rw-------. 1 postgres postgres 5711 Jul 17 13:39 pg_hba.conf
-rw-------. 1 postgres postgres 2640 Jul 17 13:39 pg_ident.conf
drwx------. 4 postgres postgres 68 Jul 17 13:39 pg_logical
drwx------. 4 postgres postgres 36 Jul 17 13:39 pg_multixact
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_notify
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_replslot
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_serial
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_snapshots
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_stat
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_stat_tmp
drwx------. 2 postgres postgres 18 Jul 17 13:39 pg_subtrans
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_tblspc
drwx------. 2 postgres postgres 6 Jul 17 13:39 pg_twophase
-rw-------. 1 postgres postgres 3 Jul 17 13:39 PG_VERSION
drwx------. 3 postgres postgres 60 Jul 17 13:39 pg_wal
drwx------. 2 postgres postgres 18 Jul 17 13:39 pg_xact
-rw-------. 1 postgres postgres 88 Jul 17 13:39 postgresql.auto.conf
-rw-------. 1 postgres postgres 29676 Jul 17 13:39 postgresql.conf
-rw-------. 1 postgres postgres 70 Jul 17 13:39 postmaster.opts
-rw-------. 1 postgres postgres 73 Jul 17 13:39 postmaster.pid

```

Hope to get help from the community.

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 17, 2024, 2:41pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/13 "2024-07-17T14:41:19Z")

</div>

Did you notice this error message, this looks like a permissions issue? Maybe, or not, it has something to do with your issue.

```auto
postgres=# \q
**could not save history to file "/home/postgres/.psql_history"** : Success
[postgres@rocky8 ~]$
[postgres@rocky8 ~]$ cat /etc/redhat-release
Rocky Linux release 8.9 (Green Obsidian)
[postgres@rocky8 ~]$ psql
psql (16.3)
Type "help" for help.

```

---

<div class="post-metadata">

### Author: ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)
#### Post date: [July 17, 2024, 2:44pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/14 "2024-07-17T14:44:07Z")

</div>

One other thought. It would be helpful to reiterate the URL for the documentation you are following.

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 17, 2024, 2:53pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/15 "2024-07-17T14:53:17Z")

</div>

I wonder what the hell went wrong,didn’t anyone else come across it?it’s also a good reproduce.

```auto
[postgres@rocky8 ~]$ ll -a
total 266860
drwx------. 2 postgres postgres 4096 Jul 17 13:39 .
drwxr-xr-x. 4 root root 37 Jul 17 13:29 ..
-rw-------. 1 postgres postgres 401 Jul 17 14:50 .bash_history
-rw-r--r--. 1 postgres postgres 18 Aug 2 2022 .bash_logout
-rw-r--r--. 1 postgres postgres 543 Jul 17 13:38 .bash_profile
-rw-r--r--. 1 postgres postgres 376 Aug 2 2022 .bashrc
-rw-------. 1 postgres postgres 2397 Jul 17 14:50 logfile
-rw-r--r--. 1 postgres postgres 273228701 Jul 17 13:29 percona-postgresql-16.3-ssl1.1-linux-x86_64.tar.gz
-rw-------. 1 postgres postgres 565 Jul 17 13:41 .psql_history
-rw-------. 1 postgres postgres 1113 Jul 17 13:38 .viminfo
[postgres@rocky8 ~]$ getenforce
Disabled
[postgres@rocky8 ~]$ systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[postgres@rocky8 ~]$ psql
psql (16.3)
Type "help" for help.

malloc(): invalid size (unsorted)
Aborted (core dumped)

```

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 26, 2024, 2:10am UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/16 "2024-07-26T02:10:31Z")

</div>

I’m surprised that we haven’t had this issue internally?

---

<div class="post-metadata">

### Author: ![gwy195600](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gwy195600](https://forums.percona.com/u/gwy195600)
#### Post date: [July 26, 2024, 3:21am UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/17 "2024-07-26T03:21:39Z")

</div>

It has been tested and installed using the Yum method without problems.So I think there’s something wrong with the binary package that this.

---

<div class="post-metadata">

### Author: ![muhammad.aqeel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/muhammad.aqeel/32/19498_2.png) [@muhammad.aqeel](https://forums.percona.com/u/muhammad.aqeel)
#### Post date: [April 18, 2025, 12:29pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/18 "2025-04-18T12:29:14Z")

</div>

Hello,  
Thanks for raising this issue. I have fixed the issue and it should be available in upcoming release of tarballs. Meanwhile you can do it like this as workaround

# On OL8/RHEL8/Alma8/Rocky8

LD\_PRELOAD=/lib64/libreadline.so.7 ./psql

# On OL9/RHEL9/Alma9/Rocky9

LD\_PRELOAD=/lib64/libreadline.so.8 ./psql

---

<div class="post-metadata">

### Author: ![Evgeniy\_Patlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/evgeniy_patlan/32/41_2.png) [@Evgeniy\_Patlan](https://forums.percona.com/u/Evgeniy_Patlan)
#### Post date: [June 11, 2025, 1:15pm UTC](https://forums.percona.com/t/psql-is-bug-this-issue-was-also-encountered-in-postgresql-16-3/31608/19 "2025-06-11T13:15:34Z")

</div>

Please note that for the latest release this issue was fixed and you don’t need to add preloads
