Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sQBht-008MbT-4c for pgsql-admin@arkaria.postgresql.org; Sat, 06 Jul 2024 20:08:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sQBhr-005vkL-9z for pgsql-admin@arkaria.postgresql.org; Sat, 06 Jul 2024 20:08:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sQBhq-005vkD-VG; Sat, 06 Jul 2024 20:08:26 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sQBhk-000kiQ-2H; Sat, 06 Jul 2024 20:08:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 466K8HkJ563363; Sat, 6 Jul 2024 16:08:17 -0400 From: Tom Lane To: Wasim Devale cc: Pgsql-admin , pgsql-admin@postgresql.org Subject: Re: psql utility In-reply-to: References: Comments: In-reply-to Wasim Devale message dated "Sun, 07 Jul 2024 01:14:32 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <563361.1720296497.1@sss.pgh.pa.us> Date: Sat, 06 Jul 2024 16:08:17 -0400 Message-ID: <563362.1720296497@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Wasim Devale writes: > I want to ask if psql is compatible with any postgresql version? > Backward compatibility won't work, I know, but can there be a confirmation > of forward compatibility from anyone? As far as basic functionality goes, you can mix-n-match psql and server versions over a very wide range. psql's backslash commands (in particular the \d family) may fail if the server is newer than psql, if there are incompatible catalog changes psql isn't prepared for. Tab completion might be hit-or-miss for the same reason. As a perhaps extreme example, I tried psql 8.4 against a current (18-to-be) server: $ psql ... psql (8.4.22, server 18devel) WARNING: psql version 8.4, server version 0.0. Some psql features might not work. Type "help" for help. regression=# select * from int8_tbl ; -- tab completion worked here q1 | q2 ------------------+------------------- 123 | 456 123 | 4567890123456789 4567890123456789 | 123 4567890123456789 | 4567890123456789 4567890123456789 | -4567890123456789 (5 rows) regression=# \d int8_tbl ERROR: column "reltriggers" does not exist LINE 1: ...ECT relchecks, relkind, relhasindex, relhasrules, reltrigger... ^ HINT: Perhaps you meant to reference the column "pg_class.relhastriggers". > It works but any links or documentation or if anyone faced any issues > please let me know. The Notes section of the psql man page says psql works best with servers of the same or an older major version. Backslash commands are particularly likely to fail if the server is of a newer version than psql itself. However, backslash commands of the \d family should work with servers of versions back to 9.2, though not necessarily with servers newer than psql itself. The general functionality of running SQL commands and displaying query results should also work with servers of a newer major version, but this cannot be guaranteed in all cases. (9.2 is the current support cutoff for backslash command testing; that horizon moves from time to time.) regards, tom lane