-- Fixing psql version issue
-- Higher postgres version commands will not work even postgres cluster is higher version and your psql version is lower version
Example: \ds commands will not work psql 8
case : \ds command not worked even after using postgres 10.12
example:
postgres=# \db
ERROR: column "spclocation" does not exist
LINE 3: spclocation AS "Location"
-- Find postgres cluster version
postgres=# select version();
version
--------------------------------------------------------------------
PostgreSQL 10.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23), 64-bit
(1 row)
postgres=# select spcname from pg_tablespace;
spcname
------------
pg_default
pg_global
pg_demo_ts
(3 rows)
postgres=# \db
ERROR: column "spclocation" does not exist
LINE 3: spclocation AS "Location"
^
postgres=# \q
-- See your psql version
bash-4.1$ psql postgres
Password:
psql (8.4.18, server 10.12)
WARNING: psql version 8.4, server version 10.12.
Some psql features might not work.
Type "help" for help.
postgres-# \q
bash-4.1$
Let us fix: ( Note: you use your postgres binary location)
Find pg_env.sh file
bash-4.1$ cd /opt/PostgreSQL/10
bash-4.1$ ls pg_env.sh
pg_env.sh
Run below shell script:
bash-4.1$ source pg_env.sh
bash-4.1$ psql postgres
Password:
psql.bin (10.12)
Type "help" for help.
Now run the command, it will work.
postgres=# \db
List of tablespaces
Name | Owner | Location
------------+----------+----------------------
pg_default | postgres |
pg_global | postgres |
pg_demo_ts | postgres | /home/demo_base
(3 rows)
postgres=#
-- Higher postgres version commands will not work even postgres cluster is higher version and your psql version is lower version
Example: \ds commands will not work psql 8
case : \ds command not worked even after using postgres 10.12
example:
postgres=# \db
ERROR: column "spclocation" does not exist
LINE 3: spclocation AS "Location"
-- Find postgres cluster version
postgres=# select version();
version
--------------------------------------------------------------------
PostgreSQL 10.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23), 64-bit
(1 row)
postgres=# select spcname from pg_tablespace;
spcname
------------
pg_default
pg_global
pg_demo_ts
(3 rows)
postgres=# \db
ERROR: column "spclocation" does not exist
LINE 3: spclocation AS "Location"
^
postgres=# \q
-- See your psql version
bash-4.1$ psql postgres
Password:
psql (8.4.18, server 10.12)
WARNING: psql version 8.4, server version 10.12.
Some psql features might not work.
Type "help" for help.
postgres-# \q
bash-4.1$
Let us fix: ( Note: you use your postgres binary location)
Find pg_env.sh file
bash-4.1$ cd /opt/PostgreSQL/10
bash-4.1$ ls pg_env.sh
pg_env.sh
Run below shell script:
bash-4.1$ source pg_env.sh
bash-4.1$ psql postgres
Password:
psql.bin (10.12)
Type "help" for help.
Now run the command, it will work.
postgres=# \db
List of tablespaces
Name | Owner | Location
------------+----------+----------------------
pg_default | postgres |
pg_global | postgres |
pg_demo_ts | postgres | /home/demo_base
(3 rows)
postgres=#
No comments:
Post a Comment